【发布时间】:2018-08-20 04:48:08
【问题描述】:
我要安装wxPython/4.0.1
在此页面上显示了所有类型的轮文件。我有 Ubuntu 14.04 64 位和 Python 3.5,所以我认为我应该使用 wxPython-4.0.1-cp35-cp35m-win32.whl 但这对我来说并不完全清楚。 该页面缺少简单的完整安装说明。
@nepix32 帮助我并显示了 Linux 版本https://wxpython.org/pages/downloads/,我一直指向https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04/
apt-get
我的偏好是使用 apt-get,所以我在 SO 上搜索并发现:Installing wxpython on ubuntu 14.04 和 using travis-ci with wxpython tests 两者都失败了。
所以我继续在轮子上搜索。
安装轮子
所以我继续在轮子上搜索。所以我发现:How do I install a Python package with a .whl file?6 首先我阅读https://stackoverflow.com/tags/python-wheel/info 和https://pypi.python.org/pypi/wheel Wheel 好像不是标准安装的,所以我下载了文件 wheel-0.30.0 并解压。
首先我升级了 pip:
sudo pip install --upgrade pip
然后在wheel中执行setup.py:
sudo python3.5 setup.py install
这似乎成功了。
尝试使用wheel安装wxpython
然后我想安装wheel文件:
sudo pip install /home/hulsman/Downloads/wxPython-4.0.1-cp35-cp35m-win32.whl
我认为对于 python3.x 应该使用 pip3,而不是 pip。所有示例都显示 pip。我都试过了,都没有成功。
我也试过了:
sudo -H pip3 install /home/hulsman/Downloads/wxPython-4.0.1-cp35-cp35m-win32.whl
所有尝试都返回几乎相同的错误消息:
wxPython-4.0.1-cp35-cp35m-win32.whl 不是该平台支持的滚轮。
使用特定的 Linux 版本
我用过
wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl
但不知道'm'和'mu'版本的区别。结果是:
sudo pip install /home/hulsman/Downloads/wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl wxPython
The directory '/home/hulsman/.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/hulsman/.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.
wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl is not a supported wheel on this platform.
hulsman@vbox11:~/Downloads$
并带有 -H 标志:
hulsman@vbox11:~/Downloads$ sudo -H pip install /home/hulsman/Downloads/wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl wxPython
wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl is not a supported wheel on this platform.
hulsman@vbox11:~
检查我的环境
$ pip -V | grep -o "(.*)"
(python 3.4)
Pip 指向 Python3.4
$ pip3.5 install -i https://localhost --trusted-host localhost cffi==1.11.4
pip3.5: command not found
pip3.5 不存在
$ python3.5 -c "import pip; print(pip.pep425tags.get_abbr_imp())"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'pip.pep425tags' has no attribute 'get_abbr_imp'
这失败了。所以我尝试了:
$ python3.5 -c "import pip; print(pip.pep425tags.get_abbr_impl())"
cp
所以我尝试更新 pip :
~$ pip install -U pip
要求已经是最新的:pip in /usr/local/lib/python3.4/dist-packages
我尝试遵循 L. Martin 的 Install pip for python 3.5 中的建议,但没有成功。
使用 pip3 的行为是相同的。
你能告诉我什么时候出错,我该如何解决这个问题?
【问题讨论】:
-
您下载了一个用于 32 位 Windows 的轮子,但您似乎使用的是 Linux。
-
是的,我有疑问。我找不到 Linux 发行版。是否有 Linux 发行版,如果有,我在哪里可以找到它?
-
为少数 Linux 发行版提供了一些预构建的轮子。寻找 extras/linux 下载,explained on wxPython/Downloads in section Linux wheels。基本上你必须下载匹配的轮子 (distro-gtk2/gtk3) 并 pip 安装它。
-
@nepix32 谢谢。我按照你的回答执行了。但结果是一样的。
-
@Bernard:认为您的整个问题是您不清楚您实际在哪个 Python 中工作。 Ubuntu 似乎默认带有 3.4,但不知何故你在 3.5 中做事。所以如果事情变得奇怪,我要做的第一件事就是检查我的假设:首先输入
python:版本是否符合您的预期?如果是,请制作pip list。如果显示的软件包不是您所期望的,那么您就有问题了。这应该适用于任何正确的activated Python 环境
标签: python-3.x pip wxpython python-wheel