1. jupyter notebook 安裝
•創建 jupyter 目錄
mkdir jupytercd jupyter/
•創建獨立的 Python3 運行環境,并激活進入該環境
virtualenv --python=python3 --no-site-packages venvsource 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 服務器搭建,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林站長站網站的支持!
新聞熱點
疑難解答