1. 程式人生 > 其它 >CentOS 7 安裝Jupyter記錄

CentOS 7 安裝Jupyter記錄

技術標籤:pythonjupyter伺服器操作pythonJupyter

一、安裝python,我這裡安裝的3.6.5

1、安裝依賴環境

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

2、下載Python3

wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz

3、新建安裝資料夾

mkdir /usr/local/python3

4、解壓並進入安裝檔案

tar -zxvf Python-3.6.5.tgz
cd Python-3.6.5

5、編譯安裝python3

make && make install

6、新增軟連結,讓python3pip3這兩個命令指向剛剛安裝的python3.6

ln -s /usr/local/python3.6/bin/python3.6 /usr/bin/python3
ln -s /usr/local/python3.6/bin/pip3 /usr/bin/pip3

7、檢驗python3安裝是否ok

python3 -V
pip3 -v

8、更新pip3

 pip3 install --upgrade pip

二、安裝jupyter notebook

1、下載jupyter

pip3 install -i https://pypi.douban.com/simple  jupyter

2、生成配置檔案

jupyter notebook --generate-config --allow-root
# 配置檔案生成在:~/.jupyter/jupyter_notebook_config.py

3、生成密碼

from notebook.auth import passwd
passwd()

Enter password:
Verify password:
Out[2]: 'sha1:ce23d945972f:34769685a7ccd3d08c84a18c63968a41f1140274'

3、修改配置檔案

c.NotebookApp.ip='*'#設定訪問notebook的ip,*表示所有IP,這裡設定ip為都可訪問
c.NotebookApp.password=u'sha1:5df252f58b7f:bf65d53125bb36c085162b3780377f66d73972d1'#填寫剛剛生成的密文
c.NotebookApp.open_browser=False#禁止notebook啟動時自動開啟瀏覽器(在linux伺服器一般都是ssh命令列訪問,沒有圖形介面的。所以,啟動也沒啥用)
c.NotebookApp.port=8888#指定訪問的埠,預設是8888。

4、後臺啟動

nohup jupyter notebook --allow-root > jupyter.log 2>&1 &
# nohup jupyter notebook --allow-root --ip=0.0.0.0 > deep.log &

5、驗證安裝是否成功

http://[your remote ip]:8888/

出現下圖證明安裝成功!