服务器端运行Jupyter Notebook进行

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_39051011/article/details/84401040

1.安装Anaconda.Anaconda集成了大量的第三方pyhton库,使用简单,这里我们就选它了。

<span style="color:#f8f8f2"><code class="language-bash"><span style="color:#e6db74">mkdir</span> anaconda
<span style="color:#e6db74"><span style="color:#e6db74">cd</span></span> anaconda
<span style="color:#e6db74">wget</span> https://repo.continuum.io/archive/Anaconda3-4.4.0-Linux-x86_64.sh
<span style="color:#e6db74">bash</span> Anaconda3-4.4.0-Linux-x86_64.sh 
</code></span>

mkdir是新建一个目录,用于放置我们的Anaconda.(这里并未分区,因为我也不会啊!2.gif)

cd是进入目录

wget 是从某个网址下载某个文件,后面是下载地址。你可以选择你需要的版本,anaconda下载地址:https://www.continuum.io/downloads#linux

bash就是安装anaconda

 2.设置Jupyter登陆密码

 

<span style="color:#f8f8f2"><code class="language-bash">jupyter notebook --generate-config  <span style="color:slategray"><span style="color:#75715e"># 生成jupyter notebook配置文件</span></span>
ipython <span style="color:slategray"><span style="color:#75715e">#打开ipython</span></span>
from notebook.auth <span style="color:#e6db74">import</span> <span style="color:#e6db74">passwd</span>
</code>passwd() #生成密码</span>

2e9b19d216ac44cf8950c8a21f7c8d65707536c6

    3.修改jupyper配置文件

<span style="color:#333333"><span style="color:#f8f8f2"><code class="language-bash"><span style="color:#f8f8f2"><span style="color:#e6db74">$vi</span></span> ~/.jupyter/jupyter_notebook_config.py</code></span></span>

把下面的文字粘贴进去(在putty中,按右键可以粘贴剪切板中的文字哟!编辑好后按esc键,输入:wq保存并退出7.gif

<span style="color:#333333"><span style="color:#f8f8f2"><code class="language-bash">c.NotebookApp.ip<span style="color:#f8f8f2">=</span><span style="color:#a6e22e"><span style="color:#e6db74">'*'</span></span>
c.NotebookApp.password <span style="color:#f8f8f2">=</span> u<span style="color:#a6e22e"><span style="color:#e6db74">'把上面的文本粘贴到这里'</span></span>
c.NotebookApp.open_browser <span style="color:#f8f8f2">=</span> False
c.NotebookApp.port <span style="color:#f8f8f2">=</span>8888</code></span></span>

c65ea1d628d95ab21f873a925a349556844be978

   4.启动jupyter。在命令行输入jupyter notebook &将jupyter加入任务。

   5.远程访问。最重要的一步,退出所有连接!退出所有连接!退出所有连接!重要的事情说3遍。ecs不允许多终端在线的(当初就是不知道,让我配置到怀疑人生12.gif)打开浏览器,输入访问地址http://ip:8888,输入第3步设置的Jupyter密码即可登录

5a5b8fc73750726d8b351e94a2fc408c29125964

 

展开阅读全文

运行jupyter notebook 出现如下报错

12-05

环境 anaconda2 tensorflow1.10.1 python2.7 jupyter notebook 4.2.1rn报错如下:rn Kernel started: 3ffc7b27-5215-4d1c-b6c2-3c4236ba7789rnTraceback (most recent call last):rn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/runpy.py", line 174, in _run_module_as_mainrn "__main__", fname, loader, pkg_name)rn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/runpy.py", line 72, in _run_codern exec code in run_globalsrn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in rn app.launch_new_instance()rn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/traitlets/config/application.py", line 657, in launch_instancern app.initialize(argv)rn File "", line 2, in initializern File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_errorrn return method(app, *args, **kwargs)rn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 469, in initializern self.init_sockets()rn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 260, in init_socketsrn self.init_iopub(context)rn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 268, in init_iopubrn self.iopub_thread = IOPubThread(self.iopub_socket, pipe=True)rn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/ipykernel/iostream.py", line 66, in __init__rn self.io_loop = IOLoop(make_current=False)rn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tornado/util.py", line 209, in __new__rn instance.initialize(**args)rn File "/home/ghf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tornado/platform/epoll.py", line 26, in initializern super(EPollIOLoop, self).initialize(impl=select.epoll(), **kwargs)rnTypeError: initialize() got an unexpected keyword argument 'make_current'rnrnKernelRestarter: restart failedrnThe kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted. If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work until the notebook is reopened. 论坛

没有更多推荐了,返回首页