安装pandas失败:PEP 517构建wheel报错、缺VC++14.0及numpy==1.19.3适配版
安装pandas常见报错解决方案
你遇到的报错信息如下:
ERROR: Could not build wheels for pandas which use PEP 517 and cannot be installed directly error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools" Building wheel for pandas (PEP 517) error ERROR: Command errored out with exit status 1 ERROR: No matching distribution found for numpy==1.19.3 Installing build dependencies ... error ERROR: No matching distribution found for numpy==1.19.3
以上报错由两个核心问题导致:一是缺少编译pandas所需的C++依赖环境,二是当前环境无法匹配到指定版本的numpy依赖包。可按以下步骤逐一尝试解决:
解决步骤
- 先升级基础包管理工具到最新版本,避免版本过旧导致的依赖识别错误
运行命令:pip install --upgrade pip setuptools wheel - 提前安装适配的numpy版本,跳过报错中指定的1.19.3版本限制
运行命令:pip install numpy>=1.21.0 - 安装pandas时关闭PEP 517构建选项,避免触发本地编译流程
运行命令:pip install pandas --no-use-pep517 - 若上述步骤仍失败,需安装Microsoft C生成工具:
搜索「Microsoft C Build Tools」下载官方安装包,安装时勾选「使用C++的桌面开发」选项,安装完成后重启命令行终端,再重新执行pandas安装命令即可。 - 替代方案:如果不想手动配置C++编译环境,可使用Anaconda/miniconda管理Python环境,conda会自动处理所有依赖匹配和编译问题,直接运行命令即可完成安装:
conda install pandas
内容的提问来源于stack exchange,提问作者Kamaleswar Mohanta
相关产品推荐
相关产品推荐

