Pip 无法为 Python 3.10(32 位)安装 wxPython

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

我安装了两个Python 3.10的框架。 64 位 Python 有

wxPython310
。但是 32 位 Python 没有任何
wxPython

我尝试用

wxPython
安装
https://wxpython.org/Phoenix/snapshot-builds/wxPython-4.1.2a1.dev5259+d3bdb143.tar.gz
,但它显示了这样的错误代码。

  Running setup.py install for wxPython ... error
  error: subprocess-exited-with-error

  × Running setup.py install for wxPython did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      C:\Users\tiger\AppData\Local\Programs\Python\Python310-32\lib\site-packages\setuptools\dist.py:717: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
        warnings.warn(
      C:\Users\tiger\AppData\Local\Programs\Python\Python310-32\lib\site-packages\setuptools\dist.py:294: DistDeprecationWarning: use_2to3 is ignored.
        warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
      running install
      running build
      C:\Users\tiger\AppData\Local\Temp\pip-req-build-b6xigzyz\build.py:42: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
        from distutils.dep_util import newer, newer_group
      Traceback (most recent call last):
        File "C:\Users\tiger\AppData\Local\Temp\pip-req-build-b6xigzyz\build.py", line 49, in <module>
          from buildtools.wxpysip import sip_runner
        File "C:\Users\tiger\AppData\Local\Temp\pip-req-build-b6xigzyz\buildtools\wxpysip.py", line 20, in <module>
          from sipbuild.code_generator import (set_globals, parse, generateCode,
      ModuleNotFoundError: No module named 'sipbuild'
      WARNING: Building this way assumes that all generated files have been
      generated already.  If that is not the case then use build.py directly
      to generate the source and perform the build stage.  You can use
      --skip-build with the bdist_* or install commands to avoid this
      message and the wxWidgets and Phoenix build steps in the future.

      "C:\Users\tiger\AppData\Local\Programs\Python\Python310-32\python.exe" -u build.py build
      Command '"C:\Users\tiger\AppData\Local\Programs\Python\Python310-32\python.exe" -u build.py build' failed with exit code 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> wxPython

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
python pip wxpython python-wheel python-zipfile
4个回答
1
投票

Python 3.10 存在一些问题。处理这种情况最简单的方法是将你的 python 版本降级到 3.9.13.

如果我没记错的话,最后一个 wxPython 出现在 Python 3.10 之前。

我遇到了同样的情况并尝试了几个解决方案,因为我不想降级我的 python 版本,但我浪费了太多我没有的时间。 所以现在只需降级并等待新版本,或者使用 Tkinter。


0
投票

我昨天将我的 python 更新到 3.10 并遇到了类似的问题。

我猜你缺少 wxpython 用来安装的系统包。

请在这里查看先决条件。安装这些之后再试一次。它也需要更长的时间


0
投票

假设我们在 Linux 上...

安装预制轮子

wxpython
wheel url 是特定于 ubuntu 操作系统版本和 python 版本的 - 根据需要进行更改。安装额外的linux包是因为wxpython wheel(二进制)依赖于它们。

$ pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython
$ sudo apt-get install libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0

然后就可以成功了

python3
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> 

pip install wxpython - 构建 wxpython 轮子

这从源代码我们自己构建了一个 wxpython 轮(二进制),而不是使用有时有限的预建轮选择(例如,没有臂轮)。这需要一段时间,但非常简单,可以在

intel x86
上工作,也可以在
arm
上的 linux 上工作。请参阅https://github.com/wxWidgets/Phoenix/issues/2225了解为什么需要
attrdict3
解决方法。

$ sudo apt-get install dpkg-dev build-essential python3-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev libgstreamer-plugins-base1.0-dev libgtk-3-dev libjpeg-dev libnotify-dev libpng-dev libsdl2-dev libsm-dev libtiff-dev libwebkit2gtk-4.0-dev libxtst-dev
$ pip install attrdict3
$ pip install wxpython

-2
投票

安装各种版本的常见问题是用于安装的 python 解释器

确保使用兼容版本的 python 来安装 wxPython310 您使用什么 IDE?

对于所有情况,我建议确保使用正确的 Python 版本完成安装,如果您不知道,请重新安装所需的版本并确保您安装的版本支持该软件包

安装教程:链接

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