pip安装报错“error: microsoft visual c++ 14.0 or greater is required”
在windows的anaconda中使用pip安装工具包的时候出现报错信息
如下图所示:
经排查发现主要错误是由
“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/”
引起的,而这个工具是microsoft build tools for visual studio 或visual studio code 等软件的一个组件。
因此,我们需要安装microsoft build tools for visual studio 或visual studio code,安装时选中相应的组件包就可以了。
方法一:使用 microsoft build tools for visual studio安装包
step 1 打开 visual studio installer
step 2 然后安装“使用c++的桌面开发”并确保安装详细信息的前两项勾选
step 3 点击 “修改” 安装即可。
待安装好后,重新打开anaconda命令窗口,然后进入对应的虚拟环境,使用pip重新安装就不会报错了。
方法二:使用 visual studio code 安装包
step 1 安装 visual studio code
按默认流程安装就行
step 2 在 visual studio code 中安装 c++ 插件
step 3 安装 build tools for visual studio 20xx
下载安装即可
待安装好后,重新打开anaconda命令窗口,然后进入对应的虚拟环境,使用pip重新安装就不会报错了。
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。
发表评论