pip安装wxPython报错“Running setup.py install for wxPython ... error”

当尝试使用Python3.10的pip安装wxPython时遇到'Running setup.py install for wxPython...error'的问题。原因是wxPython目前最高支持到Python3.9。解决方案是下载并安装Python3.9,然后通过Python3.9的pip来安装wxPython。验证安装成功的方法是检查pip安装命令后的终端输出,如果显示wxPython已成功安装,则问题得到解决。
部署运行你感兴趣的模型镜像

1. 现象

使用 Python 3.10.2 的 pip 工具安装 wxPython 报错 “Running setup.py install for wxPython … error”:
请添加图片描述

2. 问题定位

当前最新的 wxPython 版本为 4.1.1,只支持到 Python 3.9,即不支持本机安装的 Python 3.10
请添加图片描述

3. 解决方案

(1) 下载 Python 3.9 并安装

官网下载 Python 3.9
请添加图片描述

(2) 使用 Python 3.9 的 pip 安装 wxPython

python3.9 -m pip install wxPython

4. 验证

查看执行 pip 安装命令后的终端输出,wxPython 被成功安装!
请添加图片描述

您可能感兴趣的与本文相关的镜像

Python3.10

Python3.10

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

Collecting wxPython Using cached wxPython-4.2.2.tar.gz (57.4 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: six in d:\python\python安装目录\lib\site-packages (from wxPython) (1.17.0) Requirement already satisfied: numpy in d:\python\python安装目录\lib\site-packages (from wxPython) (1.21.6) Installing collected packages: wxPython DEPRECATION: wxPython is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 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 ╰─> [35 lines of output] D:\python\python安装目录\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type' warnings.warn(msg) running install running build Will build using: "D:\python\python安装目录\python.exe" 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] Python's architecture is 64bit cfg.VERSION: 4.2.2 Running command: build Running command: build_wx Traceback (most recent call last): File "build.py", line 2416, in <module> main(sys.argv[1:]) File "build.py", line 208, in main function(options, args) File "build.py", line 1477, in cmd_build cmd_build_wx(options, args) File "build.py", line 1487, in cmd_build_wx checkCompiler() File "build.py", line 800, in checkCompiler info = getMSVCInfo(PYTHON, arch, set_env=True) File "C:\Users\亲爱的~1\AppData\Local\Temp\pip-install-n52rpvqf\wxpython_b4f1884af17548e2a89bd91e663aa437\buildtools\config.py", line 1009 , in getMSVCInfo from attrdict import AttrDict ModuleNotFoundError: No module named 'attrdict' Finished command: build_wx (0.2s) Finished command: build (0.3s) 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. "D:\python\python安装目录\python.exe" -u build.py build Command '"D:\python\python安装目录\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.
05-19
Requirement already satisfied: six in c:\users\l00w09635\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (1.17.0) Requirement already satisfied: numpy in c:\users\l00w09635\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (1.21.6) Building wheels for collected packages: wxPython Building wheel for wxPython (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [37 lines of output] running bdist_wheel running build 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\l00w09635\appdata\local\programs\python\python37\python.exe" -u build.py build Will build using: "c:\users\l00w09635\appdata\local\programs\python\python37\python.exe" 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] Python's architecture is 64bit cfg.VERSION: 4.2.2 Running command: build Running command: build_wx Command '"c:\users\l00w09635\appdata\local\programs\python\python37\python.exe" -c "import os, sys, setuptools.msvc; setuptools.msvc.isfile = lambda path: path is not None and os.path.isfile(path) ; ei = setuptools.msvc.EnvironmentInfo('x64', vc_min_ver=14.0); env = ei.return_env(); env['vc_ver'] = ei.vc_ver; env['vs_ver'] = ei.vs_ver; env['arch'] = ei.pi.arch; env['py_ver'] = sys.version_info[:2]; print(env)"' failed with exit code 1. Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\users\l00w09635\appdata\local\programs\python\python37\lib\site-packages\setuptools\msvc.py", line 1107, in __init__ self.si = SystemInfo(self.ri, vc_ver) File "c:\users\l00w09635\appdata\local\programs\python\python37\lib\site-packages\setuptools\msvc.py", line 583, in __init__ vc_ver or self._find_latest_available_vs_ver()) File "c:\users\l00w09635\appdata\local\programs\python\python37\lib\site-packages\setuptools\msvc.py", line 598, in _find_latest_available_vs_ver 'No Microsoft Visual C++ version found') distutils.errors.DistutilsPlatformError: No Microsoft Visual C++ version found Finished command: build_wx (0.119s) Finished command: build (0.119s) Command '"c:\users\l00w09635\appdata\local\programs\python\python37\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: Failed building wheel for wxPython Running setup.py clean for wxPython Failed to build wxPython ERROR: Could not build wheels for wxPython, which is required to install pyproject.toml-based projects
最新发布
11-06
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值