【问题标题】:Installing wxPython on Windows: DistutilsPlatformError: Microsoft Visual C++ 14.2 or greater is required在 Windows 上安装 wxPython:DistutilsPlatformError:需要 Microsoft Visual C++ 14.2 或更高版本
【发布时间】:2022-01-17 13:54:06
【问题描述】:

我已经安装了:

  • Python 3.10.1
  • PyCharm 社区 2021.3
  • Visual Studio 构建工具 2022,包括:
    • C++ 构建工具核心功能
    • C++ 2022 可再发行更新
    • C++ 核心桌面功能
    • MSVC v143 - VS 2022 C++ x64/x86 构建工具(最新)
    • Windows 10 SDK (10.0.19041.0)
    • 适用于 Windows 的 C++ CMake 工具
    • 测试工具核心功能 - 构建工具
    • C++ AddressSanitizer
    • C++/CLI 支持 v143 构建工具(最新)
    • 用于 v143 构建工具的 C++ 模块(x64/x86 - 实验性)

尝试在我的项目的 virtualenv 中安装 wxPython 时,我收到此错误:

distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.2 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

错误和我在 Internet 上可以找到的任何内容(包括此处)都告诉我下载 C++ 构建工具并安装 C++ 14.2 或更高版本/最新版本。我有:

  • 做到了(参见上面的列表),
  • 重新启动
  • venv/Scripts/pip install --upgrade setuptools
  • venv/Scripts/pip install --upgrade wheel
  • venv/Scripts/pip install --upgrade pip

我在这里缺少什么?是否需要在某处配置某种路径变量,以便 pip/wheel/setuptools 知道在哪里可以找到编译器?

【问题讨论】:

  • 我猜 distutils 只是尚未更新以支持 vs 2022,您可能会在 vs 2019 上取得更大的成功
  • 唉,运气不好。卸载 2022 构建工具并安装 2019 构建工具,包括 MSVC v142、Windows 10 SDK、适用于 Windows 的 C++ CMake 工具、测试工具核心功能 - 构建工具、C++ AddressSanitizer 和对 v142 构建工具的 C++/CLI 支持。

标签: python c++ pycharm wxpython


【解决方案1】:

我也有同样的问题。解决了我使用 Python 3.9.9 的问题。 它可能与 Python 3.10.1 中的 distutils 问题有关,来自 msvc9compiler.py 的警告:

DeprecationWarning:distutils 软件包已被弃用并计划用于 在 Python 3.12 中删除

这导致:

引发 DistutilsPlatformError("无法找到 vcvarsall.bat")

【讨论】:

    猜你喜欢
    • 2021-02-19
    • 2021-12-30
    • 2021-09-15
    • 1970-01-01
    • 1970-01-01
    • 2021-12-04
    • 2018-04-05
    • 2022-09-26
    • 2021-12-21
    相关资源
    最近更新 更多