windows连接远端服务器的jupyter notebook
首先,我们需要登陆到我们的服务器,在anaconda环境中下载jupyter notebook。
登录到服务器之后,我们可以使用source activate xxx
,其中xxx
是anaconda的环境,可以使用默认的base
,或者自己创建新的环境。
然后使用pip install jupyter
下载jupyter notebook。
下载完成之后,我们回到windows环境下,打开cmd,使用ssh -L 8888:localhost:8888 username@xxx.xxx.xxx.xxx -p 22
,其中前面的两个8888分别是本地端口号和远程端口号,一般都是默认的8888,如果不是可以进行修改,然后username
是登录服务器的用户名,@后跟上服务器的ip地址,最后的22是端口号,ssh默认是22,可以不用修改。
ssh -L [本地端口]:localhost:[远程端口] [远程用户名]@[远程IP] -p [ssh连接端口]
这时候我们已经连接到了远端的服务器,只需要进入对应的环境,然后使用jupyter notebook
打开即可。
运行后就出现了一个jupyter notebook的url,在浏览器输入这个url就可以在windows上访问远端服务器的jupyter notebook了。