【问题标题】:Spyder won't connect to kernel / iPython consoleSpyder 不会连接到内核/iPython 控制台
【发布时间】:2016-02-22 05:54:04
【问题描述】:

自从昨晚我的笔记本电脑崩溃(原因不明)后,Spyder 一直无法连接到内核。我收到此错误:

IOError: Could not find u'kernel-1809.json' in ['.', '~/Library/Jupyter/runtime']

(每次我尝试启动 iPython 控制台时,json 文件的名称都会更改。)

这似乎与我在此处其他地方看到的 matplotlib 1.5 问题无关 - 它使用的是 1.4.3。

iPython(4.0.0 版)从命令行运行良好。

Mac 10.10.1(优胜美地)。蜘蛛 2.3.7。达尔文上的 Python 2.7.10 64 位、Qt 4.8.7、PyQt4 (API v2) 4.11.3

更新包括日志

>>> /Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/nbformat/current.py:19: UserWarning: nbformat.current is deprecated.

- use nbformat for read/write/validate public API
- use nbformat.vX directly to composing notebooks of a particular version

ERROR: 3rd party plugin import failed for `p_pylint`
Traceback (most recent call last):
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/otherplugins.py", line 53, in get_spyderplugins_mods
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderplugins/p_pylint.py", line 23, in <module>
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderplugins/widgets/pylintgui.py", line 71, in <module>
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderplugins/widgets/pylintgui.py", line 61, in get_pylint_version
  File "subprocess.pyc", line 710, in __init__
  File "subprocess.pyc", line 1335, in _execute_child
OSError: [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/externalconsole.py", line 925, in <lambda>
give_focus=give_ipyclient_focus))
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/externalconsole.py", line 1033, in register_ipyclient
give_focus=give_focus)
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/ipythonconsole.py", line 836, in register_client
self.connect_client_to_kernel(client)
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/ipythonconsole.py", line 1048, in connect_client_to_kernel
client.password)
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/plugins/ipythonconsole.py", line 1017, in create_kernel_manager_and_client
cf = find_connection_file(connection_file)
  File "/Volumes/Spyder-Py2/Spyder-Py2.app/Contents/Resources/lib/python2.7/jupyter_client/connect.py", line 185, in find_connection_file
raise IOError("Could not find %r in %r" % (filename, path))
IOError: Could not find u'kernel-2018.json' in ['.', u'/Users/garyspatterson/Library/Jupyter/runtime']

** 进一步更新**

我删除了用户目录中 .spyder2/ 文件夹下的所有文件,重新打开了 Spyder,它能够连接到 iPython 控制台。到目前为止,一切都很好。麻烦的是,当我添加到 PYTHONPATH 管理器的路径时(这样我可以导入外部模块,例如 nltk),我又遇到了同样的错误。

【问题讨论】:

  • 在您的问题中添加一些日志会很好。
  • 我遇到了完全相同的问题。我试图让 Spyder 使用带有 nltk 的 virtualenv,并得到同样的错误。删除 `.spyder2/` 并不是一个真正的解决方案,因为它会重置所有 Spyder 设置,并且您会重新使用默认解释器。您在这方面取得了进展吗?
  • @silentser - 我一直无法弄清楚。这个问题发生在我直接安装的 Spyder 中。我最终安装了 Anaconda 并在此安装中使用了 Spyder。现在不需要添加到 PYTHONPATH 管理器的路径,所以它工作正常。但是我仍然不知道为什么其他 Spyder 就这样停止了工作。祝你好运。

标签: python spyder


【解决方案1】:

有一个类似的问题,并且能够通过创建一个安装了相同依赖项的新 virtualenv 来解决它。 现在 Spyder 正在使用指向新环境的lib/python2.7/site-packagesPYTHONPATH

【讨论】:

    猜你喜欢
    • 2015-03-04
    • 2023-01-10
    • 2018-07-27
    • 2015-05-29
    • 2017-05-22
    • 2020-07-08
    • 1970-01-01
    • 2020-04-16
    • 2017-03-09
    相关资源
    最近更新 更多