记录一下在Jupyter notebook中切换内核遇到的问题

写在前面,理想的情况下这个问题真的很简单,只需要按照以下步骤依次执行命令,两分钟就能搞定。

# 1.打开anaconda prompt

# 2.查看已经安装过的虚拟环境
conda env list

# 3.切换环境
conda activate your-env

# 4.安装ipykernel 或者 conda install ipykernel也可
pip install ipykernel

# 5.将自己的环境添加到ipython的kernel中
python -m ipykernel install --user --name your-env

# 6.打开jupyter notebook

我想像中的过程应该是这样的,然后就把它搞定了,但——

conda activate RDKit

pip install jupyterlab

pip install ipykernel

python -m ipykernel install --user --name RDKit

conda deactivate

理想很丰满,现实它偏不让你顺利走完!

我在敲下这个命令时【python -m ipykernel install --user --name RDKit】报错!!!说我没有IPython.core模块。

记录一下在Jupyter notebook中切换内核遇到的问题_第1张图片

我怀疑是IPython没有安装好,于是乎,参考博客完美解决问题 。jupyter运行出错,提示 “ ModuleNotFoundError: No module named 'IPython.core' ” 的解决方法_weixin_43064339的博客-CSDN博客jupyter运行出错,提示“no module named ipython-core”pip install ipython --ignore-installed ipythonhttps://blog.csdn.net/weixin_43064339/article/details/88594211

pip install ipython --ignore-installed ipython

重启jupyter notebook,就可以看到已经有了虚拟环境了 

记录一下在Jupyter notebook中切换内核遇到的问题_第2张图片

在启动的时候又出现了内核连接不了的问题

记录一下在Jupyter notebook中切换内核遇到的问题_第3张图片

这里的报错意思是: IOLoop没有初始化成是因为 tornado 的版本功过高导致的,网上都说要不更新tornado 要不降低版本到4.5。参考连接博客解决了问题彻底解决:AttributeError:type object IOLoop has no attribute initialized_Joyyang_c的博客-CSDN博客IOLoop没有初始化成是因为 tornado 的版本功过高导致的,网上都说要不更新tornado 要不降低版本到4.5。去官网查看后找到源码:import timeimport warningstry: import tornadotornado from tornado.log import gen_log from tornado import ioloop if not hasattr(ioloop.IOLoop, 'configurable_dehttps://blog.csdn.net/Joyyang_c/article/details/108486172

 解决办法:

1.首先在你所在的环境下用conda list   or  pip list 查看自己的tornado版本;

conda list 

2.然后pip uninstall tornado  or conda uninstall tornado

pip uninstall tornado 

# or

conda uninstall tornado

3.conda list 再次确认是否卸载成功

4.安装 pip install tornado==4.4.3 

pip install tornado==4.4.3 

# or

conda install tornado==4.4.3 

5.关闭重新在端输入jupyter notebook 成功进入(如果安装4.4.3出现setuptools没有先下载这个就ok)

记录一下在Jupyter notebook中切换内核遇到的问题_第4张图片

 以上耗时两小时,过程虽然很曲折,但好在结果是好的!!!!!!!

你可能感兴趣的:(python学习,jupyter,python,ide)