You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows11 64位Python3.11安装wxPython失败,请求协助解决

解决Windows 11 64位+Python 3.11安装wxPython失败的问题

问题背景

在Windows 11 64位环境下使用Python 3.11.3执行pip install wxPython时,出现无法构建wxPython wheel的错误,核心提示为未找到Microsoft Visual C++版本。已提前安装attrdict、attrdict3、requests、MAVProxy和Cmake等依赖,但问题依旧。

具体报错信息

C:\RobotFramework>py
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

C:\RobotFramework>pip install wxPython
Collecting wxPython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata (setup.py) … done
Collecting pillow (from wxPython)
Using cached Pillow-9.5.0-cp311-cp311-win_amd64.whl (2.5 MB)
Requirement already satisfied: six in c:\robotframework\lib\site-packages (from wxPython) (1.16.0)
Requirement already satisfied: numpy in c:\robotframework\lib\site-packages (from wxPython) (1.24.3)
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
╰─> [47 lines of output]
C:\RobotFramework\Lib\site-packages\setuptools\dist.py:771: 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:\RobotFramework\Lib\site-packages\setuptools\config\setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
C:\RobotFramework\Lib\site-packages\setuptools\dist.py:317: DistDeprecationWarning: use_2to3 is ignored.
warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
running bdist_wheel
running build
Will build using: “C:\RobotFramework\python.exe”
3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)]
Python’s architecture is 64bit
cfg.VERSION: 4.2.0

Running command: build
Running command: build_wx
Command '"C:\RobotFramework\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 "", line 1, in 

File "C:\RobotFramework\Lib\site-packages\setuptools\msvc.py", line 1120, in __init__

self.si = SystemInfo(self.ri, vc_ver)

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\RobotFramework\Lib\site-packages\setuptools\msvc.py", line 596, in __init__

vc_ver or self._find_latest_available_vs_ver())

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\RobotFramework\Lib\site-packages\setuptools\msvc.py", line 610, in _find_latest_available_vs_ver

raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: No Microsoft Visual C++ version found
Finished command: build_wx (0.313s)
Finished command: build (0.313s)
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:\RobotFramework\python.exe" -u build.py build
Command '"C:\RobotFramework\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

解决方案

方案1:安装对应版本的Microsoft Visual C++ Build Tools

wxPython编译需要Visual C++ 14.0及以上版本的构建工具,操作步骤:

  • 运行Visual Studio Installer,选择「Desktop development with C++」工作负载
  • 确保勾选「MSVC v143 - VS 2022 C++ x64/x86 build tools」(匹配Python 3.11依赖的MSC v.1934版本)
  • 安装完成后重启命令行,重新执行pip install wxPython

方案2:使用预编译wheel包跳过编译

不想安装编译工具的话,直接用预编译包:

  • 获取匹配Python 3.11、Windows 64位的wxPython wheel文件(如wxPython-4.2.0-cp311-cp311-win_amd64.whl)
  • 执行pip install 本地wheel文件完整路径完成安装

方案3:指定兼容版本安装

若新版本存在兼容问题,尝试安装稳定版本:

pip install wxPython==4.1.1

内容的提问来源于stack exchange,提问作者Hima Manae

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 06:00:05