当前位置:   article > 正文

在windows上访问linux中的jupyter虚拟环境_windows使用linux的jupyter

windows使用linux的jupyter

1、在linux上激活虚拟环境

-bash-4.2$ source activate py38

2、使用ipykernel为不同的虚拟环境配置不同名字

(1) 安装ipykernel

(py38) -bash-4.2$ conda install ipykernel

 (2) 配置虚拟环境的内核名称

python -m ipykernel install --user --name=你的环境名称 --display-name "Python (环境名称)"  

  1. (py38) -bash-4.2$ python -m ipykernel install --user --name=py38 --display-name "Python py38"

3 linux上启动jupyter

(py38) -bash-4.2$ jupyter notebook --ip=0.0.0.0 --port=9999 --no-browser

4 在windows访问linux上的jupyter

  此时在 new 中可以看到我们命名的环境名称:Python 38

  在代码中查看当前的环境:

  1. import os
  2. import sys
  3. # sys.path.append(os.getcwd())
  4. print(os.path)
  5. print(os.getcwd())
  6. val = os.system('ls -l')

 5 对同一份代码切换不同的运行环境

切换到 Python py38虚拟环境

参考文章:

(1) https://www.qedev.com/python/331225.html

(2) https://blog.csdn.net/weixin_42167712/article/details/100057079

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/245148
推荐阅读
相关标签
  

闽ICP备14008679号