当我使用命令jupyter notebook时,出现以下错误和回溯:

Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'

Traceback (most recent call last):


File "/Users/hamedbh/anaconda3/bin/jupyter-notebook", line 4, in <module>
    import notebook.notebookapp
  File "/usr/local/lib/python2.7/site-packages/notebook/notebookapp.py", line 31, in <module>
    from zmq.eventloop import ioloop
  File "/usr/local/lib/python2.7/site-packages/zmq/__init__.py", line 34, in <module>
    from zmq import backend
  File "/usr/local/lib/python2.7/site-packages/zmq/backend/__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "/usr/local/lib/python2.7/site-packages/zmq/utils/sixcerpt.py", line 34, in reraise
    raise value
  File "/usr/local/lib/python2.7/site-packages/zmq/backend/__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "/usr/local/lib/python2.7/site-packages/zmq/backend/select.py", line 27, in select_backend
    mod = __import__(name, fromlist=public_api)
ModuleNotFoundError: No module named 'zmq.backend.cython'


我正在使用完整的Anaconda发行版,尽管我创建了一个环境,但我是从根Anaconda env(即/ Users / me / anaconda3)而不是env内完成此操作的。

一些快速的详细信息可能有助于解决问题:


python --version = Python 3.6.1 :: Anaconda 4.4.0(x86_64)
操作系统是MacOS Sierra 10.12.6


我不知道引起KeyError: PYTHONPATH的同一件事是否也导致jupyter notebook失败。

最佳答案

似乎pyzmq是问题所在。运行pip install pyzmq --upgradepip unistall pyzmq & pip install pyzmq以确保您使用的是最新版本。

关于python - 无法使用Anaconda python 3.6.1打开Jupyter Notebook,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45466248/

10-15 23:01