Ubuntu里搭建jupyter notebook
程序员文章站
2022-06-01 12:46:01
...
1. 安装python
[email protected]:/home# apt install python3.8
[email protected]:/home# apt install python3.8-venv
2. 建立并启动python虚拟环境
[email protected]:/home# mkdir data_science_env # 建立目录
[email protected]:/home# cd data_science_env/ # 进入目录,
[email protected]:/home/data_science_env# python3.8 -m venv env # 在目录下建立名为env的虚拟环境
[email protected]:/home/data_science_env# source env/bin/activate # 启动虚拟环境
虚拟环境启动后,命令行提示符前会出现(env),表明目前处在env虚拟环境中,在此环境中安装的各种python库和配置都只对该环境生效。
3. 安装并配置jupyter notebook
# 在虚拟环境中操作
(env) [email protected]:/home/data_science_env# pip install jupyter
# 重置notebook配置
(env) [email protected]:/home/data_science_envjupyter notebook --generate-config --allow-root
Overwrite /root/.jupyter/jupyter_notebook_config.py with default config? [y/N]y
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
# 进入python命令行,设置notebook密码,记住最后生成的公钥
(env) [email protected]:/home/data_science_env# python
Python 3.8.0 (default, Oct 28 2019, 16:14:01)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from notebook.auth import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:901ea3458357:e5e947d9129e7b485339d...'
# 打开notebook配置文件,并做相应修改
(env) [email protected]:/home/data_science_env# vim /root/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip = '0.0.0.0' # 对外提供访问的ip
c.NotebookApp.port = 8888 # 对外提供访问的端口
c.NotebookApp.open_browser = False # 启动不打开浏览器
c.NotebookApp.password = 'sha1:901ea3458357:e5e947d9129e7b485339d...' # 公钥
c.NotebookApp.notebook_dir = u'/home/data_science_env/notebook' # 设置jupyter启动后默认文件夹
c.NotebookApp.allow_root = True # 允许root用户执行
4. 启动jupyter notebook
(env) [email protected]:/home/data_science_env# jupyter notebook
参考:https://www.jianshu.com/p/0c9dcbf277ed
上一篇: 文本框输入邮箱自动联想补全
下一篇: eclipse自动补全左侧代码
推荐阅读
-
云服务centos搭建jupyter notebook并通过外网访问
-
Ubuntu系统实现将Jupyter notebook项目发布到GitHub
-
在jupyter notebook的kernel里显示自己的环境
-
Python3 jupyter notebook 服务器搭建过程
-
基于Jupyter notebook搭建Spark集群开发环境的详细过程
-
搭建tensorflow-quantum编程环境(Jupyter Notebook)
-
Ubuntu里搭建jupyter notebook
-
ECS搭建Jupyter Notebook服务
-
docker搭建tensorflow jupyter notebook环境
-
搭建远程 Jupyter Notebook