到公司装深度学校环境。项目较旧,安装依赖,一堆报错(基于 conda 环境):

numpy 安装报需要 C++ 14.0

No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils

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/

[end of output]

然后使用 whl 方式安装成功了(如果你是 conda 环境不要急着坐这步,后面有更好的方式)。

matplotlib 同样报错需要 C++ 14.0

building 'matplotlib.ft2font' 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/

解决方案

使用 whl 尝试安装,本人不想再找 whl 了,粗略看了下,我的安装里面还涉及到了python版本和库版本的问题、库和库之间的版本问题。太麻烦了。 安装 Microsoft Visual C++ 14.0 支持,按照链接进去下载生成工具。注意,很多人傻傻的直接安装了个vs ide到电脑上,其实不需要的。点击“单个组件”,在里面安装搜索 MSVS 安装即可!!(针对本问题还可以尝试下一个方法,更好更快更方便) 补充:MSVC、Windows SDK、CLI支持(.NET 框架会自动添加) 直接使用 conda 命令,完美解决。以后还是优先使用 conda 安装依赖呀~

conda install matplotlib

# 指定版本

# conda install matplotlib==3.3.2

后面安装 pytorch,笔者也是直接使用 conda 安装了,很方便。以前真是买椟还珠啊

参考链接

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: