CentOS 7 - 安装 Jupyter
/

CentOS 7 - 安装 Jupyter

SOSO
2022-04-24 / 0 评论 / 129 阅读 / 正在检测是否收录...

安装虚拟环境

一、安装依赖

pip3 install virtualenv

二、安装 virtualenvwrapper

pip3 install virtualenvwrapper

三、更新 setuptools, pip

pip3 install --upgrade setuptools

python3 -m pip install --upgrade pip

四、环境变量

vim ~/.bashrc

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3

source /usr/local/bin/virtualenvwrapper.sh

五、执行 source

source ~/.bashrc

六、 创建虚拟环境

mkvirtualenv myenv

# 指定python版本创建虚拟环境
mkvirtualenv -p [python路径]  [虚拟环境名称]
mkvirtualenv -p /usr/bin/python3 myenv

七、删除虚拟环境

rmvirtualenv myenv

八、 进入虚拟环境

workon myenv

九、 退出虚拟环境

deactivate

十、 安装 jupyter

pip3 install jupyter

十一、 创建Jupyter登录密码

import IPython

print(IPython.lib.passwd())
Enter password:
Verify password:
sha1:adsfadc9aa2f6cwkfsjaowkfak0d5392ba87042e629

十二、 生成配置文件

jupyter notebook --generate-config --allow-root

十三、 编辑配置文件

vim /root/.jupyter/jupyter_notebook_config.py

# 编辑配置文件添加以下内容

# 运行所有IP访问
c.NotebookApp.ip = '*'
c.NotebookApp.allow_root = True

# 启动时是否自动打开浏览器
c.NotebookApp.open_browser = False

# 指定端口号
c.NotebookApp.port = 8888

# 密码设置
c.NotebookApp.password =u'sha1:9safsfwee9fdfsfadaa2f6c0wefsafwfasbsfadsafasf629'

# jupyter notebook工作目录
c.ContentsManager.root_dir = '/home/username/jupyter/'

十四、 后台启动

nohup jupyter notebook > /var/log/jupyter/jupyter.log 2>&1 &
0

评论

博主关闭了当前页面的评论