1.安装Anaconda  

wget https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh

安装过程中会有:

... ...
installing: zlib-1.2.8-3 ...
installing: anaconda-4.4.0-np112py27_0 ...
installing: conda-4.3.21-py27_0 ...
installing: conda-env-2.6.0-0 ...
Python 2.7.13 :: Continuum Analytics, Inc.
creating default environment...
installation finished.
Do you wish the installer to prepend the Anaconda2 install location
to PATH in your /root/.bashrc ? [yes|no]
[no] >>> yes

 生效.bashrc文件:

source ~/.bashrc

export PATH=~/anaconda3/bin:$PATH

二。安装jupyter
需要安装jupyter,理论上安装好anaconda后就能够运行了,可以试试conda命令是否有效,未找到jupyter命令则pip安装

pip install jupyter

 三。配置
先安装一些package+配置

pip install ipython

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

 生成密码:

[root@localhost ~]# ipython

Python 3.5.2 (default, Aug 4 2017, 02:13:48) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password: 
Verify password: 
Out[2]: 'sha1:5311cd8b9da9:70dd3321fccb5b5d77e66080a5d3d943ab9752b4'

修改生成的配置文件,将以下几个地址修改如下,并且去掉该行前的#,使其生效
vi /root/.jupyter/jupyter_notebook_config.py

c.NotebookApp.ip='*'    //改成服务器的IP地址
c.NotebookApp.password = u'sha1:5311cd8b9da9:70dd3321fccb5b5d77e66080a5d3d943ab9752b4'
c.NotebookApp.open_browser = False
c.NotebookApp.port =9999 #随便指定一个端口,使用默认8888也可以,确保服务器上其他人没有使用该端口

访问jupyter notebook
现在命令行下开启服务,查看系统指定的是哪个端口,有可能是9999

jupyter notebook --ip=0.0.0.0 --no-browser --allow-root

之后就能用ip:9999访问了服务器了。

之后每次都需要在shell中输入jupyter notebook才能启动jupyter,如果想让其在后台运行,需要输入:
nohup jupyter notebook &     命令,注意&不可缺少

 

转载自:https://blog.csdn.net/qq_37279279/article/details/83410034

Logo

更多推荐