Ubuntu安裝Jupyter Notebook教程
一.Jupyter介紹
Jupyter Notebook是一個交互式筆記本,支持運行40多種編程語言。Jupyter Notebook 的本質是一個 Web 應用程序,便于創(chuàng)建和共享文學化程序文檔,支持實時代碼,數(shù)學方程,可視化和 markdown。用途包括:數(shù)據(jù)清理和轉換,數(shù)值模擬,統(tǒng)計建模,機器學習等等。
二.安裝步驟
環(huán)境:Docker(17.04.0-ce)、鏡像Ubuntu(16.04.3)
1. 更新軟件列表
root@787c084a44e4:~# apt-get update
2. 安裝pip
root@787c084a44e4:~# apt-get install -y python3-pip
3. 更新pip(-m參數(shù)將庫中的pip模塊作為腳本運行,--upgrade更新pip模塊)
root@787c084a44e4:~# python3 -m pip install --upgrade pip
4. 使用pip安裝Jupyter
root@787c084a44e4:~# python3 -m pip install jupyter
5. 使用pip安裝python繪圖庫(示例需要使用)
root@787c084a44e4:~# python3 -m pip install matplotlib
6. 創(chuàng)建Jupyter默認配置文件
root@787c084a44e4:~# jupyter notebook --generate-config
7. 生成SHA1加密的密鑰,保存密鑰,如'sha1:XXXXXX'
root@787c084a44e4:~# ipython
輸入
from notebook.auth import passwd passwd()
8. 設置密鑰,修改配置文件
root@787c084a44e4:~# vim .jupyter/jupyter_notebook_config.py
在文件末尾增加
c.NotebookApp.password = u'sha1:XXXXXX'
9. 運行Jupyter(--ip指定ip,--no-browser不打開瀏覽器,--allow-root允許root運行)
root@787c084a44e4:~# jupyter notebook --ip=0.0.0.0 --no-browser --allow-root
10. 打開瀏覽器輸入http://172.17.0.2:8888/

三.Jupyter示例
新建python3筆記
%matplotlib inline import numpy as np import matplotlib.pyplot as plt x = np.arange(9) y = np.sin(x) plt.plot(x, y) plt.show()
運行結果

四.異常情況
1. locale.Error: unsupported locale setting異常

設置locale,使用默認本地化設置
root@787c084a44e4:~# export LC_ALL=C
2. OSError: [Errno 99] Cannot assign requested address異常

運行Jupyter時增加--ip=0.0.0.0參數(shù)
root@787c084a44e4:~# jupyter notebook --ip=0.0.0.0 --no-browser --allow-root
3. ImportError: No module named 'matplotlib'異常

安裝matplotlib庫
root@787c084a44e4:~# python3 -m pip install matplotlib
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
- Python學習工具jupyter notebook安裝及用法解析
- Python安裝Jupyter Notebook配置使用教程詳解
- Pycharm安裝并配置jupyter notebook的實現(xiàn)
- jupyter notebook的安裝與使用詳解
- windows python3安裝Jupyter Notebooks教程
- win10下安裝Anaconda的教程(python環(huán)境+jupyter_notebook)
- Windows下的Jupyter Notebook 安裝與自定義啟動(圖文詳解)
- TensorFlow安裝及jupyter notebook配置方法
- Jupyter Notebook安裝及使用方法解析
相關文章
python類的方法屬性與方法屬性的動態(tài)綁定代碼詳解
這篇文章主要介紹了python類的方法屬性與方法屬性的動態(tài)綁定代碼詳解,具有一定借鑒價值,需要的朋友可以參考下2017-12-12
基于Python+Matplotlib繪制漸變色扇形圖與等高線圖
這篇文章主要為大家介紹了如何利用Python中的Matplotlib繪制漸變色扇形圖與等高線圖,文中的示例代碼講解詳細,感興趣的小伙伴可以了解一下方法2022-04-04
Django2.1.7 查詢數(shù)據(jù)返回json格式的實現(xiàn)
這篇文章主要介紹了Django2.1.7 查詢數(shù)據(jù)返回json格式的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-12-12
Python GUI之tkinter窗口視窗教程大集合(推薦)
這篇文章主要介紹了Python GUI之tkinter窗口視窗教程大集合,看這一篇教程足了,本文通過圖文實例相結合給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-10-10
Python HTMLParser模塊解析html獲取url實例
這篇文章主要介紹了Python HTMLParser模塊解析html獲取url實例,HTMLParser是python用來解析html的模塊,HTMLParser采用的是一種事件驅動的模式,需要的朋友可以參考下2015-04-04

