目录
下载anaconda安装包
地址:https://www.anaconda.com/products/individual
bash命令安装anacodna
bash Anaconda3-2021.11-Linux-x86_64.sh
更改环境变量
vim ~/.bashrc
export PATH="/root/anaconda3/bin:$PATH"
source ~/.bashrc
生成jupyter notebook配置文件
jupyter notebook --generate-config
设置密码
输入
ipython
进入jupyter,输入:
Out要copy,下一步会用到
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:*********************************c'
# Enter password 是在本地浏览器登陆使用的密码,Out[2] 输出的是填写在配置文件中的密钥
In [3]: exit()
配置文件
$ vim ~/.jupyter/jupyter_notebook_config.py
# 在文件末尾添加
c.NotebookApp.allow_remote_access = True # 可能没有需要自己添加
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:*********************************c' # 填写刚才out生成的密钥
c.NotebookApp.port = 2021 # 端口号,自己选一个,如果是阿里云服务器,需要到安全组开放对应端口
# wq保存退出
打开jupyter notebook
jupyter notebook # 普通打开
jupyter notebook --allow-root # 可远程连接,终端关闭则服务关闭
nohup jupyter notebook --allow-root & # 终端关闭服务不关闭
新发现
安装Jupyter Lab
conda命令安装
conda install -c conda-forge jupyterlab
运行
nohup jupyter lab --allow-root&
目录要切换到lab
重置密码
注意区分是 notebook 还是 lab
jupyter notebook password # 按提示,输入密码 notebook
jupyter lab password # 按提示,输入密码 lab