gpt4 book ai didi

python - 回溯错误 : Does idlex need to be installed in a particular location?

转载 作者:太空宇宙 更新时间:2023-11-04 01:13:01 24 4
gpt4 key购买 nike

我正在运行 Python-2.7.8.AMD64 并在 friend 的建议下安装了 idlex。

当我使用快捷方式启动 idlex 时,会弹出一个带有 Traceback 的 Dos 框,如所附代码框中所示。

idlex.py - Shortcut

Traceback (most recent call last):
File "C:\downloads\python\idlex-1.12\idlexlib\extensionManager.py", line 131,
in load_extension
mod = importlib.import_module('.' + fullname, package=__package__)
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\downloads\python\idlex-1.12\idlexlib\extensions\IPyIDLE.py", line 253
, in <module>
class IdleXSubSocketChannel(SimpleChannel, channels.IOPubChannel):
NameError: name 'channels' is not defined
could not load IPyIDLE

我不确定这是什么意思。

idlex 按预期运行,没有我可以确定的明显错误。

是否需要将 idlex 安装在与 Python 相关的特定位置才能消除此错误? (即在 Lib 的 python 文件夹中?)

谢谢。

最佳答案

看来您缺少 IPython。

您可以执行 pip install ipythoneasy_install ipython,请参阅 here如果您需要帮助。

错误是一个 NameError,表示它没有变量 channels 的定义,该变量由依赖于 IPython 的导入调用,位于“idlex-1.12/idlex1.12/idlexlib/extension/IPyIDLE.py":

if HAS_IPYTHON:
# IPython
...
import IPython.kernel.channels as channels
...

发生错误的地方在文件的下方:

class IdleXSubSocketChannel(SimpleChannel, channels.IOPubChannel):
channel_name = 'sub'

一旦你安装了 IPython,这个错误就解决了,但是你会在之后遇到另一个错误(如果你有基础安装):

ImportError: IPython.kernel.zmq requires pyzmq >= 2.1.11

这可以通过 pip install pyzmqeasy_install pyzmq 解决,完成后 IdleX 应该可以运行,不会向您抛出错误。

关于python - 回溯错误 : Does idlex need to be installed in a particular location?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26512054/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com