我在尝试打开 jupyter notebook 时遇到了问题

我在尝试打开 jupyter notebook 时遇到了问题

我开始使用 Anaconda,但无法打开 jupyter 笔记本。当我尝试时,它发出应用程序启动错误,显示以下内容:

Traceback (most recent call last):
File "C:\Users\pc\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in 
from notebook.notebookapp import main
File "C:\Users\pc\AppData\Roaming\Python\Python37\site-packages\notebook\notebookapp.py", line 47, in 
from zmq.eventloop import ioloop
File "C:\Users\pc\AppData\Roaming\Python\Python37\site-packages\zmq\__init__.py", line 47, in 
from zmq import backend
File "C:\Users\pc\AppData\Roaming\Python\Python37\site-packages\zmq\backend\__init__.py", line 40, in 
reraise(*exc_info)
File "C:\Users\pc\AppData\Roaming\Python\Python37\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\pc\AppData\Roaming\Python\Python37\site-packages\zmq\backend\__init__.py", line 27, in 
_ns = select_backend(first)
File "C:\Users\pc\AppData\Roaming\Python\Python37\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\pc\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython\__init__.py", line 6, in 
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from 'zmq.backend.cython' (C:\Users\pc\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython\__init__.py)

答案1

这对我有用,你可以尝试一下:

pip uninstall pyzmq

然后:

pip install pyzmq

我在 anaconda prompt 上运行这些命令

答案2

我在使用 jupyter notebook 和 spyder 时也遇到了类似的问题。

我的修复方法是:

  1. 卸载 anaconda 和 python3.7(或您已安装的任何版本)
  2. 删除“C:\Users\pc\AppData\Roaming\Python”Python 文件夹
  3. 重新安装 anaconda

然后,在 anaconda prompt 中写入

jupyter notebook

或者

spyder

就是这样。希望它能起作用

相关内容