Python:在Mac上wx安装失败

问题描述 投票:0回答:1

我正在运行在MacBook上使用wx的python2软件包。我正在运行python 2.7.10。当我运行包时:

con@company_computer:~/dir/pasta$ python run_pasta_gui.py 
Traceback (most recent call last):
  File "run_pasta_gui.py", line 27, in <module>
    import wx
ImportError: No module named wx

所以我尝试按照Python ImportError: No module named wx的建议安装wx>

我尝试根据https://wxpython.org/pages/downloads/index.html上的建议通过pip安装:

pip install -U wxPython

sudo pip install wxPython

sudo -H pip install wxPython

但是所有这些都说它已经安装:

Requirement already satisfied: wxPython in /usr/local/lib/python2.7/site-packages (4.0.7.post2)
Requirement already satisfied: pillow in /usr/local/lib/python2.7/site-packages (from wxPython) (6.2.2)
Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages (from wxPython) (1.11.0)
Requirement already satisfied: numpy<1.17; python_version <= "2.7" in /usr/local/lib/python2.7/site-packages (from wxPython) (1.14.2)

但是当我尝试运行run_pasta_gui.py时我又得到了原始错误>

我可以通过sudo apt-get install python-wxtools在我的Ubuntu VM上完成此操作,但这显然在Mac上不可用。

Unable to import a module that is definitely installed之后,我尝试了sudo chmod -R ugo+rX /usr/local/lib/python2.7/site-packages/,但仍无法访问wx程序包。

如何让wx用于我的python2安装?

我正在运行在MacBook上使用wx的python2软件包。我正在运行python 2.7.10。当我运行程序包时:con @ company_computer:〜/ dir / pasta $ python run_pasta_gui.py Traceback(最近一次调用...

python macos pip wxpython python-2.x
1个回答
0
投票

我在venv中运行安装,并且能够导入并列出模块

(venv) air:~ yo$ pip install wxPython Collecting wxPython Downloading https://files.pythonhosted.org/packages/17/b0/3a39e3fbea922e2f1bf2a48d5ed14d7eb1173ec8dbd3a1187f105ae06355/wxPython-4.0.7.post2-cp27-cp27m-macosx_10_9_x86_64.whl (16.9MB) |████████████████████████████████| 16.9MB 3.4MB/s Collecting pillow Downloading https://files.pythonhosted.org/packages/d1/6a/41719faa7421602a85941867059f53787ac40c85c8fe9e6bb48809e3246e/Pillow-6.2.2-cp27-cp27m-macosx_10_6_intel.whl (3.9MB) |████████████████████████████████| 3.9MB 2.7MB/s Collecting numpy<1.17; python_version <= "2.7" Downloading https://files.pythonhosted.org/packages/09/96/84cf406fe7d589f3dba9fc0f737e65985a3526c6d8c783f02d4b5a10825d/numpy-1.16.6-cp27-cp27m-macosx_10_9_x86_64.whl (13.9MB) |████████████████████████████████| 13.9MB 301kB/s Requirement already satisfied: six in ./work/virtualenvs/venv/lib/python2.7/site-packages (from wxPython) (1.13.0) Installing collected packages: pillow, numpy, wxPython Successfully installed numpy-1.16.6 pillow-6.2.2 wxPython-4.0.7.post2

© www.soinside.com 2019 - 2024. All rights reserved.