3

出乎意料的是,我的 IPython 内核停止工作,多次无法重新启动。错误消息如下所示。我不知道是什么触发了这个,以及如何解决它。我尝试升级 setuptools 并按照其他一些帖子提到的那样进行分发,但没有成功。我感谢您的帮助!

WARNING:root:kernel 0abd40d4-471d-4eef-ba76-0aacea899699 restarted
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 151, in _run_module_as_main
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 109, in _get_module_details
    return _get_module_details(pkg_main_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 101, in _get_module_details
    loader = get_loader(mod_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 464, in get_loader
    return find_loader(fullname)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 474, in find_loader
    for importer in iter_importers(fullname):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 430, in iter_importers
    __import__(pkg)
  File "/Library/Python/2.7/site-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/Library/Python/2.7/site-packages/ipykernel/connect.py", line 12, in <module>
    from IPython.core.profiledir import ProfileDir
  File "/Library/Python/2.7/site-packages/IPython/__init__.py", line 48, in <module>
    from .terminal.embed import embed
  File "/Library/Python/2.7/site-packages/IPython/terminal/embed.py", line 16, in <module>
    from IPython.core.interactiveshell import DummyMod
  File "/Library/Python/2.7/site-packages/IPython/core/interactiveshell.py", line 31, in <module>
    from pickleshare import PickleShareDB
  File "/Library/Python/2.7/site-packages/pickleshare.py", line 41, in <module>
    from path import path as Path
  File "/Library/Python/2.7/site-packages/path.py", line 126, in <module>
    except pkg_resources.DistributionNotFound:
NameError: name 'pkg_resources' is not defined
4

2 回答 2

1

在使用“sudo”安装带有 anaconda 的特定软件包后,我最近遇到了类似的错误。安装升级了 ipython 使用的一些核心包,并且明显改变了与它们相关的权限。在启动 ipython 时使用“sudo”解决了这个问题。

于 2016-04-14T13:14:20.457 回答
1

在以 root 身份在 anaconda 发行版中安装特定软件包后,我也遇到了这个错误。这是通过更改 anaconda 目录的所有权来解决的,即

chown -R myname:mygroup anaconda_dir

应该通过以用户身份而不是 root 身份安装软件包来防止

于 2016-05-18T16:34:28.327 回答