我正在运行Python-2.7.8.AMD64,并在 friend 的建议下安装了idlex。
当我使用快捷方式启动idlex时,会弹出一个Dos框,其中包含一个Traceback,如所附代码框中所示。
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 应该运行而不会向您抛出错误。
关于python - 回溯错误 : Does idlex need to be installed in a particular location?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26512054/