1、由于CentOS 7默认安装的是 Python2.7,没有pip工具。为此需要安装python3.6。安装方法参照:https://www.jianshu.com/p/7f1b9a203045 写得十分详细.
2、CentOS7中修改环境变量
#通过修改.bashrc文件:
vim ~/.bashrc
#在最后一行添上:
export PATH=/home/aojin/python3.6/bin:$PATH
#生效方法:(有以下两种)
#1、关闭当前终端窗口,重新打开一个新终端窗口就能生效
#2、输入“source ~/.bashrc”命令,立即生效
#有效期限:永久有效
#用户局限:仅对当前用户
3、安装jupyter
pip install --upgrade pip
pip install jupyter
4、设置密码获得秘钥
ipython
from IPython.lib import passwd
5、生成配置文件
jupyter notebook --generate-config
6、修改配置文件内容:vim /root/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip = 'IP'
c.NotebookApp.allow_root = True
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.password = 'sha1:...' #输入上面加密后得到的密文
c.ContentsManager.root_dir = '/home/python/jupyter_notebook'
7、启动jupyter
jupyter notebook
后台启动:
nohup jupyter notebook >out.file 2>&1 &
8、通过浏览器进行访问即可 http://127.0.0.1:8888/