我正在尝试在我的 Ubuntu 18.04 机器上安装 wxPython 4。
sudo pip install wxpython
我首先收到此警告
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
并最终出错
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-SyaTU1/wxpython/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-bzIjlK/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-SyaTU1/wxpython/
我对 wxPython3 有类似的问题,解决方案是使用 get 安装它
sudo apt-get install python-wxgtk-3.0
我还能够为 Python 3 安装 wxPython 4,但不能为 Python 2.7 安装(说明)
另外,我很困惑为什么安装 wxpython 需要这么多 CPU
sudo pip install wxpython