本文介绍了vscode未检测到ipykernel,已验证它是否已实际安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我尝试创建一个新笔记本时,Jupyter笔记本均无法启动.它说没有安装ipykernel,如果我单击安装,它说它已经为该虚拟环境(使用anaconda3创建)安装了,然后它给了我一条错误消息,我将在下面粘贴.关于是什么原因引起的或如何解决的任何想法?预先感谢!

Jupyter notebooks fail to launch every time I try to create a new one. It says that ipykernel is not installed, and if I click install it says it is already installed for this virtual environment (created with anaconda3) and then it just gives me an error message that I will paste in below. Any ideas as to what is causing this or how to fix it? thanks in advance!

Jupyter notebook failed to launch.
Error: Traceback (most recent call last):
  File "c:\Users\davis\.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\vscode_datascience_helpers\daemon\daemon_python.py", line 54, in _decorator
    return func(self, *args, **kwargs)
  File "c:\Users\davis\.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\vscode_datascience_helpers\jupyter_daemon.py", line 105, in m_exec_module_observable
    self._start_notebook(args, cwd, env)
  File "c:\Users\davis\.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\vscode_datascience_helpers\jupyter_daemon.py", line 147, in _start_notebook
    from notebook import notebookapp as app
  File "C:\Users\davis\AppData\Roaming\Python\Python38\site-packages\notebook\notebookapp.py", line 49, in <module>
    from zmq.eventloop import ioloop
  File "C:\Users\davis\AppData\Roaming\Python\Python38\site-packages\zmq\__init__.py", line 47, in <module>
    from zmq import backend
  File "C:\Users\davis\AppData\Roaming\Python\Python38\site-packages\zmq\backend\__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "C:\Users\davis\AppData\Roaming\Python\Python38\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
    raise value
  File "C:\Users\davis\AppData\Roaming\Python\Python38\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "C:\Users\davis\AppData\Roaming\Python\Python38\site-packages\zmq\backend\select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "C:\Users\davis\AppData\Roaming\Python\Python38\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython' (most likely due to a circular import) (C:\Users\davis\AppData\Roaming\Python\Python38\site-packages\zmq\backend\cython\__init__.py)

Failed to run jupyter as observable with args notebook --no-browser --notebook-dir=C:\Users\davis\AppData\Local\Temp\cda4e2c0-a341-4667-b662-1bd918e5238e --config=C:\Users\davis\AppData\Local\Temp\cda4e2c0-a341-4667-b662-1bd918e5238e\jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0

推荐答案

当您尝试安装该软件包时,VSCode表示您已在虚拟环境中安装了该软件包.这意味着您正在使用虚拟环境.但是Traceback显示您正在使用Romaing文件夹下的软件包,而不是项目下的虚拟环境.您应该选择使用虚拟环境还是使用全局环境来解决软件包问题.

When you try to install the package, VSCode said you had installed it in the virtual environment. This means you are using the virtual environment. But the Traceback shows you are using the package under the Romaing folder instead of the virtual environment under your project. You should choose either to use the virtual environment or to use the global environment and fix the package problem.

如果选择全局环境,请尝试重新安装或升级'zmq'软件包:

If you choose the global environment, try to reinstall or upgrade 'zmq' package:

重新安装:"pip卸载pyzmq"; -> "pip install pyzmq".

reinstall: "pip uninstall pyzmq" -> "pip install pyzmq".

升级:"pip install --upgrade pyzmq";或"pip install --upgrade pyzmq jupyterlab jupyter --force-reinstall".

upgrade: "pip install --upgrade pyzmq" or "pip install --upgrade pyzmq jupyterlab jupyter --force-reinstall".

您可以参考 zmq:无法启动jupyter笔记本以获取更多信息.

You can refer to zmq: Can not launch jupyter notebook for more information.

这篇关于vscode未检测到ipykernel,已验证它是否已实际安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 21:48
查看更多