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

Windows 7系统下安装Python rtmidi库失败求助

解决rtmidi在32位Windows 7+Python 3.8下的安装失败问题

问题概述

在64位处理器上运行32位Windows 7 Ultimate系统,使用Python 3.8.10执行pip install rtmidi时编译失败,核心报错提示缺少Microsoft Visual C++ 14.0及以上版本的构建工具。已尝试安装C++ Redistributable 14.0、升级pip,但问题未解决。

完整报错信息如下:

C:\Users\CEMARIECOLINA\AppData\Local\Programs\Python\Python38-32>pip install rtmidi
Collecting rtmidi
  Using cached rtmidi-2.5.0.tar.gz (56 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: rtmidi
  Building wheel for rtmidi (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ──> [16 lines of output]
      c:\users\cemariecolina\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\_distutils\extension.py:134: UserWarning: Unknown Extension options: 'headers'
        warnings.warn(msg)
      c:\users\cemariecolina\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\_distutils\dist.py:265: UserWarning: Unknown distribution option: 'description_content_type'
        warnings.warn(msg)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win32-cpython-38
      creating build\lib.win32-cpython-38\rtmidi
      copying rtmidi\collector.py -> build\lib.win32-cpython-38\rtmidi
      copying rtmidi\randomout.py -> build\lib.win32-cpython-38\rtmidi
      copying rtmidi\__init__.py -> build\lib.win32-cpython-38\rtmidi
      running build_ext
      building 'rtmidi._rtmidi' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools"
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for rtmidi
  Running setup.py clean for rtmidi
Failed to build rtmidi
ERROR: Could not build wheels for rtmidi, which is required to install pyproject toml-based projects

解决方案

1. 安装完整的Visual C++ Build Tools(而非仅运行时库)

你之前安装的C++ Redistributable仅提供运行时支持,编译rtmidi需要编译器、链接器等构建工具链:

  • 下载Visual C++ Build Tools安装程序,选择「Desktop development with C++」工作负载
  • 必须勾选x86架构的MSVC编译器组件(与你的32位Python环境匹配)
  • 同时勾选适配Windows 7的Windows SDK版本(推荐Windows 7 SDK 7.1或兼容版本)
  • 安装完成后重启命令提示符,确保构建工具的环境变量生效

2. 使用预编译wheel包跳过编译流程

若不想配置编译环境,可直接使用对应版本的预编译wheel文件安装:

  • 获取适配Python 3.8(32位)的rtmidi .whl 文件
  • 执行命令:pip install 你的wheel文件路径.whl

3. 验证环境一致性

  • 确认Python为32位:执行python -c "import sys; print(sys.maxsize > 2**32)",输出False则为32位环境
  • 检查构建工具是否正常加载:执行cl命令,若能显示编译器版本则配置成功

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.03 11:30:04