新建conda环境无法打开jupyter notebook解决办法

问题:在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环境

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值