参考文献
参考文献1: Jupyter notebook切换Python环境
问题来源
经常需要使用anaconda的虚拟环境,使用jupyter进行切换是一个好方法。其它网友总结了对nb_conda方式解决,但实践过程中出了比较严重的错误。比如,jupyter崩溃等。
- 其它虚拟环境安装jupyter,打开提示IOloop
- 安装了多个nbextensions,提示重复yaml文件错误
- jupyter运行提示404等
解决
方式:仍然使用nb_conda插件解决的方式,但通过尝试多种方式,确定了最优的流程
1. 安装anaconda
略
2. base环境整理
- 安装jupyter notebook
- 安装jupyter_contrib_nbextensions
之前安装时,运行了jupyter contrib nbextensions install --user 之后运行jupyter 提示 重复yaml文件错误。可试运行,若报错,则jupyter contrib nbextensions uninstall --user - 安装 nb_conda
conda install nb_conda
3. 管理虚拟环境
整体思路为:在base环境下的jupyter中为各个虚拟环境安装ipykernel.
ps:之前我在虚拟环境中安装,结果失败。
- 创建更多的虚拟环境(仅选择python)
- 在base环境下打开jupyter notebook
- 在jupyter notebook中转入conda界面(如下图)
点击添加
点击创建的虚拟环境 ----> 搜索栏搜索ipyker ----> 为虚拟环境安装ipykernel
结果
终于解决了。浪费了好多时间。