溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

怎么搭建Python3 jupyter notebook服務(wù)器

發(fā)布時間:2021-02-18 13:40:13 來源:億速云 閱讀:193 作者:小新 欄目:開發(fā)技術(shù)

這篇文章主要介紹怎么搭建Python3 jupyter notebook服務(wù)器,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

1. jupyter notebook 安裝

?創(chuàng)建 jupyter 目錄

mkdir jupyter
cd jupyter/

?創(chuàng)建獨立的 Python3 運行環(huán)境,并激活進入該環(huán)境

virtualenv --python=python3 --no-site-packages venv
source venv/bin/activate

?安裝 jupyter

pip install jupyter

2. jupyter notebook 配置

?創(chuàng)建 notebooks 目錄

mkdir notebooks

用于保存網(wǎng)頁端創(chuàng)建的 ipynb 文件。

?生成配置文件

jupyter notebook --generate-config

生成的配置文件保存在當(dāng)前用戶的 .jupyter 目錄下。

?生成密碼密文

python -c "import IPython; print(IPython.lib.passwd())"

執(zhí)行后輸入密碼,生成類似 'sha1:xxx:xxx' 的密文。

?修改配置文件

c.NotebookApp.allow_remote_access = True    # 允許遠程訪問
c.NotebookApp.ip = '*'             # 允許任意ip訪問此服務(wù)器
c.NotebookApp.password = 'sha1:xxx:xxx'     # 上一步生成的密文
c.NotebookApp.open_browser = False       # 運行時不打開本機瀏覽器
c.NotebookApp.allow_root =True         # 允許使用 root 權(quán)限運行
c.NotebookApp.port = 8888            # 指定 jupyter notebook 使用的端口
c.ContentsManager.root_dir = 'notebooks'    # 指定 ipynb 等文件的保存目錄

3. 啟動 jupyter notebook

?直接運行

jupyter notebook

?后臺運行

nohup jupyter notebook > ~/jupyter/jupyter.log 2>&1 &

以上是“怎么搭建Python3 jupyter notebook服務(wù)器”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI