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

Win11下pip安装pandas/nes-py报错:VC 6.0 is not supported by this module

解决pip安装Python包时误选MinGW导致的VC 6.0不支持错误

问题背景

Win11环境下已安装带MSVC组件的Visual Studio,但执行pip install pandas或pip install nes-py时仍报错:

return _bootstrap._gcd_import(name[level:], package, level)
    File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 887, in exec_module
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "C:\Users\fanby\AppData\Local\Temp\pip-build-env-x9gin6nr\overlay\lib\python3.10\site-packages\setuptools\_distutils\msvc9compiler.py", line 295, in <module>
      raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
  distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module

核心原因是系统中安装的MinGW干扰了distutils的编译器选择逻辑,导致误识别为VC 6.0版本。

解决方案

方法1:临时指定MSVC环境安装

打开VS开发人员命令提示符(或普通CMD手动加载VS环境),执行以下命令:

set DISTUTILS_USE_SDK=1
set MSSdk=1
# 替换为你的VS版本对应路径,示例为VS2022 BuildTools的x64环境
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
# 执行包安装
pip install pandas nes-py

注意:根据实际安装的VS版本(2019/2022)和系统位数(x64/x86)调整vcvarsall.bat的路径。

方法2:永久配置distutils优先使用MSVC

在Python安装目录的Lib\site-packages文件夹下,创建distutils.cfg文件,写入以下内容:

[build]
compiler=msvc

此后pip编译安装包时,会默认优先调用MSVC编译器,规避MinGW的干扰。

方法3:隔离MinGW环境干扰

  • 临时移除系统PATH中MinGW相关的路径,安装完成后再恢复配置。
  • 使用Python虚拟环境:虚拟环境的PATH不会继承系统的MinGW路径,创建并激活虚拟环境后再执行pip install命令即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.21 20:33:12