網(wǎng)站首頁 編程語言 正文
Jupyter Notebook是一個(gè)Web應(yīng)用程序,允許您創(chuàng)建和共享包含實(shí)時(shí)代碼,方程,可視化和說明文本的文檔。
簡單的介紹就是:Jupyter Notebook是Ipython的升級版,而Ipython可以說是一個(gè)加強(qiáng)版的交互式 Shell,也就是說,它比在terminal里運(yùn)行python會(huì)更方便,界面更友好
環(huán)境:
- Ubuntu16.04 64位
安裝pip
(1)更新和升級包
sudo apt-get update sudo apt-get upgrade
(2)安裝pip
sudo apt-get install python-pip3
安裝Jupyter
(1)升級pip3
sudo pip3 install --upgrade pip3
(2)安裝Jupyter
sudo pip3 install jupyter
注意這里一定要有sudo。否則Jupyter安裝會(huì)失敗
安裝成功會(huì)顯示下面的信息
注意:如果提示
運(yùn)行命令:
sudo pip3 install -vU setuptools
再次安裝
生成一個(gè) notebook 配置文件
默認(rèn)情況下,配置文件 ~/.jupyter/jupyter_notebook_config.py
并不存在,需要自行創(chuàng)建。使用下列命令生成配置文件:
jupyter notebook --generate-config
如果是 root 用戶執(zhí)行上面的命令,會(huì)發(fā)生一個(gè)問題:
Running as root it not recommended. Use --allow-root to bypass.
提示信息很明顯,root 用戶執(zhí)行時(shí)需要加上?--allow-root
?選項(xiàng)。
jupyter notebook --generate-config --allow-config
執(zhí)行成功后,會(huì)出現(xiàn)下面的信息:
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
生成密碼
自動(dòng)生成
從 jupyter notebook 5.0 版本開始,提供了一個(gè)命令來設(shè)置密碼:jupyter notebook password
,生成的密碼存儲(chǔ)在 jupyter_notebook_config.json
。
$ jupyter notebook password Enter password: **** Verify password: **** [NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json
手動(dòng)生成
除了使用提供的命令,也可以通過手動(dòng)安裝,我是使用的手動(dòng)安裝,因?yàn)?code>jupyter notebook password 出來一堆內(nèi)容,沒耐心看。打開 ipython 執(zhí)行下面內(nèi)容:
In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed
這一串就是要在 jupyter_notebook_config.py
添加的密碼。
c.NotebookApp.password = u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed' 3. 修改配置文件
?修改配置文件
在 jupyter_notebook_config.py
中找到下面的行,取消注釋并修改。
c.NotebookApp.ip='*'#163行 c.NotebookApp.password = u'sha:ce...剛才復(fù)制的那個(gè)密文' #217行 c.NotebookApp.open_browser = False#208 c.NotebookApp.port =8888 #可自行指定一個(gè)端口, 訪問時(shí)使用該端口228行
以上設(shè)置完以后就可以在服務(wù)器上啟動(dòng) jupyter notebook,jupyter notebook
, root 用戶使用 jupyter notebook --allow-root
。打開 IP:指定的端口
, 輸入密碼就可以訪問了。
需要注意的是不能在隱藏目錄 (以 . 開頭的目錄)下啟動(dòng) jupyter notebook, 否則無法正常訪問文件。
原文鏈接:https://www.cnblogs.com/wu-chao/p/8419889.html
相關(guān)推薦
- 2022-08-30 python在文件中倒序查找個(gè)關(guān)鍵詞
- 2022-10-13 Python?flask?sqlalchemy的簡單使用及常用操作_python
- 2022-08-17 React-Route6實(shí)現(xiàn)keep-alive效果_React
- 2022-12-29 淺析Python是如何實(shí)現(xiàn)集合的_python
- 2022-09-15 圖文詳解在Anaconda安裝Pytorch的詳細(xì)步驟_python
- 2022-12-23 C語言例題之輸出1000以內(nèi)的所有完數(shù)_C 語言
- 2022-09-07 Python實(shí)現(xiàn)不寫硬盤上傳文件_python
- 2024-07-15 Postman:Body類型中的x-www-from-urlencoded參數(shù)可以接受GET請求嗎?
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支