conda安装jupyter notebook
系统:CentOS
conda安装jupyter
conda install ipykernel
conda install jupyter
激活conda建立的环境(conda create),如paddle
conda activate paddle
将新建的环境写入notebook中
paddle为你的环境名;"python3"是你想要它在jupyter notebook中显示的名字,根据自己情况更改这两个值,其他的不变
python -m ipykernel install --user --name paddle --display-name "python3"
生成配置文件
jupyter notebook --generate-config
生成密码
$ jupyter notebook password
Enter password: yourpassword #输入密码
Verify password: yourpasswordagain #再次输入密码确认
#运行后结果
[NotebookPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_notebook_config.json #密码被保存的位置
修改配置文件
设置远程访问、初始目录、端口号、是否打开浏览器
vim /root/.jupyter/jupyter_notebook_config.py,在内容开头添加:
c.NotebookApp.ip='*' # 就是设置所有ip地址皆可访问
c.NotebookApp.open_browser = False #禁止自动打开浏览器
c.NotebookApp.port =8089 # 指定一个可用端口,也可以是其他闲置的端
c.NotebookApp.notebook_dir = '/root/workspace/' #设置根目录,限制访问
c.NotebookApp.allow_remote_access = True #远程访问
启动服务
jupyter notebook