Centos7安裝jupyter notebook


安裝python3

查看當前python版本

[root@iz1i4qd6oynml0z /]# python -V
Python 2.7.5

安裝python3以及檢查python3的版本

yum install python3
python3 -V

安裝jupyter notebook

pip3 install jupyter

生成配置文件

jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py

生成密碼,用剛裝好的python3就可以了

from notebook.auth import passwd
passwd()

然后會得到一個字符串,'sha1:18a311f2bceb:f7bebfa7a61f7057bc034d9affe750c8b65ead6a'
最后是修改一下配置文件
分別是密碼,端口號,允許遠程連接,默認打開瀏覽器,默認路徑

vim /root/.jupyter/jupyter_notebook_config.py
c.NotebookApp.password = 'sha1:18a311f2bceb:f7bebfa7a61f7057bc034d9affe750c8b65ead6a'
c.NotebookApp.port = 8888
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.notebook_dir = '/jupyter_notebook'

啟動jupyter notebook

jupyter notebook --allow-root

如果想掛在后台運行的話用nohup命令,然后按一下enter,退出終端的話用exit就可以了,默認會將日志文件輸出到當前目錄的nohup.out

nohup jupyter notebook --allow-root &

如果不輸出日志文件可以把日志文件輸出到黑洞

nohup jupyter notebook --allow-root >/dev/null 2>&1 &

想要退出的話可以查詢jupyter notebook占用了哪個進程

ps -aux | grep jupyter

或者是查詢端口號8888被哪個進程占用了

netstat -tunlp|grep 8888

然后把找到的進程kill掉就可以了

kill 20627


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM