配置远程服务器jupyter notebook

1.安装好jupyter和ipykernel

pip安装

pip install jupyter
pip install ipykernel

2.用ipython生成密钥

from notebook.auth import passwd
passwd()

输入自定义的密码
可以得到一串密钥,我的是

sha1:85b46ae497ee:b2cd494d1f4ded134098fee7af8b818c503c18cd

3.生成并修改jupyter的config文件

jupyter notebook --generate-config
vim ~/.jupyter/jupyter_notebook_config.py

在开头添加以下内容

c.NotebookApp.ip='*'
c.NotebookApp.password=u'sha1:85b46ae497ee:b2cd494d1f4ded134098fee7af8b818c503c18cd'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.allow_remote_access = True

4.添加现有虚拟环境

python -m ipykernel install --user --name your-env-name

其中--user用于指定为当前用户添加,否则默认添加到root(需要权限)

5.启动jupyter notebook

jupyter notebook

在本地打开浏览器,输入服务器ip地址:端口号,然后输入第二步自定义的密码即可


Reference

https://blog.csdn.net/weixin_41813895/article/details/84750990.
https://blog.csdn.net/Harrytsz/article/details/91047014

发布了5 篇原创文章 · 获赞 0 · 访问量 230

猜你喜欢

转载自blog.csdn.net/rzy1010470038/article/details/104069348