【问题标题】:Mac & Python 2.7: IDLE doesn't read newly installed libraries but iPython doesMac & Python 2.7:IDLE 不读取新安装的库,但 iPython 可以
【发布时间】:2014-01-02 01:09:10
【问题描述】:

我刚用过

sudo easy_install wx

sudo easy_install wxpython

安装 wx 和 wxpython。现在,当我尝试运行其中包含 import wx 或 import wxpython 的脚本时,我收到一条错误消息,提示未安装此类库。仅当我在 IDLE 中编写脚本然后运行它时才会发生这种情况。如果我在 iPython 中执行此操作,则模块已正确加载。这种错误的原因是什么?如何了解如何处理和修复此类错误?

【问题讨论】:

    标签: python-2.7 wxpython ipython python-idle


    【解决方案1】:

    您确定 IDLE 和 IPython 在同一个 Python 上运行吗?如果不是,那么很可能 wxPython 只安装在 IPython 使用的 Python 中,而不是 IDLE 使用的 Python 中。

    【讨论】:

    • 我不确定,我该如何检查这样的事情?另外,我如何确保我的所有模块都安装到同一个目录中?有时我使用 sudo pip install some_module 有时我使用 sudo easy_install some_module。
    • 在每个环境中执行“import sys; print.sys.prefix”。 pip 和 easy_install 之类的工具可以与任何用于执行它们的 python 配合使用,因此请检查它们的位置以及 #!脚本顶部的行。
    猜你喜欢
    • 2013-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-26
    • 2022-11-14
    • 2015-04-02
    相关资源
    最近更新 更多