這篇文章主要介紹了Python3 jupyter notebook 服務器搭建過程,非常不錯,具有一定的參考借鑑價值,需要的朋友參考下吧
1. jupyter notebook 安裝
•創建 jupyter 目錄
mkdir jupyter cd jupyter/
•創建獨立的 Python3 運行環境,並激活進入該環境
virtualenv --python=python3 --no-site-packages venv source venv/bin/activate
•安裝 jupyter
pip install jupyter
2. jupyter notebook 配置
•創建 notebooks 目錄
mkdir notebooks
用於保存網頁端創建的 ipynb 文件。
•生成配置文件
jupyter notebook --generate-config
生成的配置文件保存在當前用戶的 .jupyter 目錄下。
•生成密碼密文
python -c "import IPython; print(IPython.lib.passwd())"
執行後輸入密碼,生成類似 'sha1:xxx:xxx' 的密文。
•修改配置文件
c.NotebookApp.allow_remote_access = True # 允許遠程訪問 c.NotebookApp.ip = '*' # 允許任意ip訪問此服務器 c.NotebookApp.password = 'sha1:xxx:xxx' # 上一步生成的密文 c.NotebookApp.open_browser = False # 運行時不打開本機瀏覽器 c.NotebookApp.allow_root =True # 允許使用 root 權限運行 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 服務器搭建,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回覆大家的。在此也非常感謝大家對神馬文庫網站的支持!