关于pip安装第三方库报错,缺少Microsoft C++ Build Tools的解决方案

关于pip install [packages]报错的完美解决方法

错误信息

pip install [packages]报如下错误

ERROR: Command errored out with exit status 1:
     command: 'c:\users\lun\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lun\\AppData\\Local\\Temp\\pip-install-kdks3g5l\\netifaces_e72519e4d21d48dbbdf71a7157936488\\setup.py'"'"'; __file__='"'"'C:\\Users\\lun\\AppData\\Local\\Temp\\pip-install-kdks3g5l\\netifaces_e72519e4d21d48dbbdf71a7157936488\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\lun\AppData\Local\Temp\pip-record-8m0w8raq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lun\appdata\local\programs\python\python39\Include\netifaces'
         cwd: C:\Users\lun\AppData\Local\Temp\pip-install-kdks3g5l\netifaces_e72519e4d21d48dbbdf71a7157936488\
    Complete output (5 lines):
    running install
    running build
    running build_ext
    building 'netifaces' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\lun\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lun\\AppData\\Local\\Temp\\pip-install-kdks3g5l\\netifaces_e72519e4d21d48dbbdf71a7157936488\\setup.py'"'"'; __file__='"'"'C:\\Users\\lun\\AppData\\Local\\Temp\\pip-install-kdks3g5l\\netifaces_e72519e4d21d48dbbdf71a7157936488\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\lun\AppData\Local\Temp\pip-record-8m0w8raq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lun\appdata\local\programs\python\python39\Include\netifaces' Check the logs for full command output.

从错误信息中发现缺少C++构建工具

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools"
  • 方案1,下载构建好的.whl文件直接安装
  • 方案2,安装C++构建工具,本地构建

方案2

  • 更新一下工具
$ pip install wheel setuptools pip --upgrade

打开error中提示的https://visualstudio.microsoft.com/visual-cpp-build-tools/,下载vs_BuildTools.exe开始安装
install

选择这三个就可以。

测试
  • 安装wordcloud库测试
    wordcloud

成功build.

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值