linux服务器jupyter安装,Linux 服务器端安装 jupyter

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

1 安装相关软件

1.1 用 pip 安装 ipython/jupyter/notebook

pip install ipython jupyter notebook

ln -s /usr/local/python27/bin/ipython2 /usr/bin/ipython2

ln -s /usr/local/python27/bin/jupyter-notebook /usr/bin/jupyter-notebook2

ln -s /usr/bin/jupyter-notebook2 /usr/bin/jupyter-notebook

==说明:==

python2只能安装ipython的5.x版本。

1.2 安装 numpy/pandas/matplotlib

==说明:==

一定要先安装Numpy,因为Python 的很多其他科学计算库都建立在该库的基础上。

pip install numpy

pip install pandas

pip install matplotlib

2 配置 jupyter

2.1 生成配置文件

# 生成配置文件

jupyter-notebook --generate-config

==说明:==生成的配置文件路径为:~/.jupyter/jupyter_notebook_config.py

在哪个账号下启动 jupyter,就要在哪个账号下生成配置文件。

2.2 修改jupyter的配置文件

2.2.1 创建登录密码

进入python环境,使用python生成登录密码。

# 导入设定密码模块

>>>from notebook.auth import passwd

# 生成密码

>>>passwd()

Enter password:

Verify password:

'sha1:064cb1d6c686:0ccbd941b4725a29e79a7294ac9cc651e2bc0eaa'

# 输入密码,并且验证输入密码

# 输入两次之后,会生成一个加密字符串,将其复制下来

使用SSL证书(非必须):

# 如果要用https进行登录,需要生成ssl证书。

# 输入命令:

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem

# 更改Jupyter的配置文件中的相关字段。

c.NotebookApp.certfile = u'/absolute/path/to/your/certificate/mycert.pem'

c.NotebookApp.keyfile = u'/absolute/path/to/your/certificate/mykey.key'

2.2.2 修改配置文件

# 设定ip访问,允许任意ip访问

c.NotebookApp.ip = '*'

# 设置登录密码

c.NotebookApp.password = u'sha1:064cb1d6c686:0ccbd941b4725a29e79a7294ac9cc651e2bc0eaa'

# 不打开浏览器

c.NotebookApp.open_browser = False

# 用于访问的端口,设定一个未使用的端口即可

c.NotebookApp.port = 8888

# 默认启动位置,这样在任何工作目录下都能保证notebook的启动位置一致

c.NotebookApp.notebook_dir = u'/home/data'

2.3 启动 jupyter

nohup jupyter-notebook &

在浏览器中直接输入IP:端口就可以使用jupyter了。

例如:http://1.1.1.1:8888 。