我正在运行 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 ipython
或 easy_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 pyzmq
或 easy_install pyzmq
解决,完成后 IdleX 应该可以运行,不会向您抛出错误。
我是一名优秀的程序员,十分优秀!