本文是在anaconda的环境下配置的,装好anaconda后,jupyter-notebook就自带装上了。我们在使用python的过程中往往需要使用虚拟环境,在终端下**虚拟环境很方便,但是在jupyter-notebook中需要进行一些配置方可使用。

首先,为需要在jupyter-notebook中使用的虚拟环境安装ipykernel

conda install -n tensorflow ipykernel
//tensorflow是我的虚拟环境

jupyter-notebook添加python虚拟环境jupyter-notebook添加python虚拟环境

其次,**tensorflow虚拟环境(source activate tensorflow),然后用如下命令生成ipykernel的配置文件(–name之后跟的是在jupyter-notebook中对应虚拟环境的kernel名称)

python -m ipykernel install --name tensorflow-notebook 
//其中,tensorflow 是我的虚拟环境

jupyter-notebook添加python虚拟环境

结果:

jupyter-notebook添加python虚拟环境

相关文章:

  • 2021-07-13
  • 2021-09-28
  • 2021-12-07
  • 2021-11-02
  • 2022-12-23
  • 2021-05-21
  • 2021-04-01
猜你喜欢
  • 2022-12-23
  • 2021-07-14
  • 2021-06-03
  • 2022-12-23
  • 2021-04-17
相关资源
相似解决方案