Python3滚轮返回错误:此平台上不支持滚轮

时间:2018-03-12 08:06:57

标签: python-3.x pip wxpython python-wheel

我想安装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,因此我搜索SO并找到:Installing wxpython on ubuntu 14.04using travis-ci with wxpython tests 两者都失败了。

所以我继续在车轮上搜索。

安装滚轮

所以我继续搜索轮子。我发现:How do I install a Python package with a .whl file? 6 首先,我读了https://stackoverflow.com/tags/python-wheel/infohttps://pypi.python.org/pypi/wheel 轮子似乎没有安装标准,所以我下载了文件wheel-0.30.0并将其解压缩。

首先我升级了点子:

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行为是一样的。

你能告诉我什么时候错了,我该怎么解决这个问题?

1 个答案:

答案 0 :(得分:0)

在Linux中安装wxPython并不像Windows / OSX那样简单,因为存在太多变体:发行版,GTK2 / GTK3等。但是它们确实说明了如何在Linux中安装它:

https://wxpython.org/pages/downloads/

使用下载的车轮安装

您已经在wxPython Extras中找到了正确的滚轮(cp35m-linux_x86_64),但是必须使用目标Python版本安装它。如果找不到目标Python的点,只需使用Python的-m选项:

python3.5 -m pip install wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl

从pypi安装常规方法

普通的pip install方法也可以使用,但是对于Linux中的wxPython,这将尝试从源归档文件为您构建转盘-假设您具有所有依赖项。这将是不便且缓慢的。

同样,您必须使用正确的目标版本的Python运行它:

python3.5 -m pip install -U wxpython

直接从 wxpython.org 车轮安装(推荐)

最简单的方法是直接从他们那里得到它:

python3.5 -m pip install wxPython -U --pre \
  -f  https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04

或者,如果您只是想下载正确的轮子以便以后手动安装,并且特别想针对特定的python版本,请说3.5:

pip download wxPython \
  -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04 \
  --only-binary=:all: \
  --platform linux_x86_64 \
  --abi cp35m \
  --python-version 35 \
  -d "${HOME}/pymodules/wxpython-py35-whl"

根据需要更改URL中的发行版。请注意,此处的pip版本并不重要。

'm'和'mu'的差异在Python 3中不再相关。它与ucs2 / ucs4 unicode构建标志有关。如果您的目标是Python 2.7,则可以使用abi选项来选择'mu'版本,例如:--abi cp27mu

由于pip 19.2添加了新的debug命令,因此这类难以理解的问题可能更易于诊断。该useless not a supported wheel on this platform消息肯定没有帮助任何人。