问题:在conda的黑窗口下使用activate tensorflow1.x激活环境,然后输入jupyter notebook无法打开jupyter notebook
原因:jupyter notebook 默认安装在 base环境下,新环境没有jupyter
解决办法:
1.在 conda 环境中安装并运行 Jupyter 服务器和内核
conda create -n tensorflow1.x # creates new virtual env
conda activate tensorflow1.x # activate environment in terminal
conda install jupyter # install jupyter + notebook
jupyter notebook # start server + kernel
完成此操作后可以在该环境中直接打开jupyter notebook,这种方法就是为每一个 conda 环境 都安装 jupyter。
2 为 conda 环境创建特殊内核
conda create -n test_env # creates new virtual env
conda activate test_env # activate environment in terminal
conda install ipykernel # install Python kernel in new conda env
ipython kernel install --user --name=test_env # configure Jupyter to use Python kernel
conda activate base
jupyter notebook
完成该配置操作后要在base环境下打开jupyter notebook,打开后可以在该新环境下新建文件。
该配置只有 Python 内核会在 conda 环境中运行,系统中的 Jupyter 在不同的 conda 环境将被使用,它没有安装在 conda 环境中。
缺点:你新建一个环境,就要重复操作一次。
3 使用 nb_conda_kernels 添加所有环境
conda activate my-conda-env # this is the environment for your project and code
conda install ipykernel
conda deactivate
conda activate base # could be also some other environment
conda install nb_conda_kernels
jupyter notebook
这个方法就是一键添加所有 conda 环境
参考:(22条消息) 【最全指南】如何在 Jupyter Notebook 中切换/使用 conda 虚拟环境?_Tina姐的博客-CSDN博客_jupyter notebook怎么使用conda环境