VS Code jupyter报错Error starting original kernel

2019-11-26 22:42:55 浏览数 (1)

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://blog.csdn.net/blmoistawinde/article/details/103086657

用VS运行jupyter时报错如下

代码语言:javascript复制
Jupyter kernel cannot be started from 'Python 3.6.9 64-bit ('py36': conda)'. Using closest match Python 3.7.4 64-bit instead.
Error starting original kernel: python -m jupyter notebook --version is not running

是因为python -m jupyter notebook --version这个指令无法运行,故在命令行中尝试(已经激活了自己想要打开jupyter的那个虚拟环境,在我这里是py36),结果:

代码语言:javascript复制
(py36) D:>python -m jupyter notebook --version
Traceback (most recent call last):
  File "d:anaconda3envspy36librunpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:anaconda3envspy36librunpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:anaconda3envspy36Scriptsjupyter-notebook.EXE__main__.py", line 4, in <module>
  File "d:anaconda3envspy36libsite-packagesnotebooknotebookapp.py", line 49, in <module>
    from zmq.eventloop import ioloop
ModuleNotFoundError: No module named 'zmq.eventloop'

发现问题在zmq上,jupyter notebook依赖它,所以就会出现问题

根据 https://github.com/jupyter/notebook/issues/3435

这一问题的原因可能是pyzmq的安装中有冲突,解决方法为:

代码语言:javascript复制
pip uninstall pyzmq
pip install pyzmq

让pip在重装时自己解决冲突。

再次在VS Code中重启jupyter notebook,可以成功运行。

0 人点赞