Jupyter Notebook是很是优秀的开发环境,在Ubuntu服务器中,启动服务,经过浏览器开发,同时可视化执行.ipynb文件,这样就能够使用GPU直接执行深度学习的算法。python
环境:算法
关键点:shell
建立virtualenv虚拟环境,在虚拟环境中,安装Jupyter:浏览器
pip install jupyter
复制代码
建立密匙,密匙就是jupyter的登陆密码,生成sha1的加密字符串:bash
>> from notebook.auth import passwd
>> passwd()
Enter password:
Verify password:
'sha1:xxx'
复制代码
编辑配置文件,命名为:jupyter_config.py服务器
c.NotebookApp.ip = 'localhost' # 指定
c.NotebookApp.open_browser = False # 关闭自动打开浏览器
c.NotebookApp.port = 8812 # 端口随意指定
c.NotebookApp.password = u'sha1:xxxx' # 复制前一步生成的密钥
复制代码
启动Jupyter服务:jupyter notebook --config=jupyter_config.py
ssh
(mlp3_p37_venv) xxx@xxxx:/data1/wcl/workspace$ jupyter notebook --config=jupyter_config.py
[I 17:14:01.262 NotebookApp] Serving notebooks from local directory: /data1/wcl/workspace
[I 17:14:01.262 NotebookApp] The Jupyter Notebook is running at:
[I 17:14:01.262 NotebookApp] http://localhost:8812/
[I 17:14:01.262 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
复制代码
nohup版本的启动命令:学习
nohup jupyter notebook --config=jupyter_config.py &
复制代码
本地链接服务器的方式为:.ssh/config
测试
Host gateway
HostName xx.xx.xx.xxx
User xxx
Port xxxxx
Host 3
User xxx
HostName xxx.xx.xx.3
ProxyCommand ssh -q -W %h:%p gateway
复制代码
执行以下命令,其中:this
ssh -N -f -L localhost:8812:localhost:8812 xxx@3
复制代码
前面的是本地端口,后面的是远程端口,xxx是用户名,3是服务器。
这个命令也能够写入至系统环境中,每次启动shell都会自动执行。
本地浏览器中,输入:http://localhost:8812
在开发中,须要使用虚拟环境,所以须要在Jypyter中,增长虚拟环境。
命令以下:
(mlp3_p37_venv) xxx@3:/data/workspace$ ipython kernel install --user --name=mlp3_p37_venv
复制代码
测试Python的版本:
OK, that's all!