我对Python编码比较陌生,想了解Python中的统计信息和数据管理。为此,我想安装Matplotlib,这给了我一些问题。
我看到其他人有此问题,但是我还没有完全了解如何解决它。
要安装我使用
pip install matplotlib
我已安装以下规格
我遇到的第一个错误是安装Microsoft Studio,所以我做到了。 我也尝试过更新点子
BUILDING MATPLOTLIB
matplotlib: yes [3.1.1]
python: yes [3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)]]
platform: yes [win32]
...
checkdep_freetype2.c
src/checkdep_freetype2.c(1): fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1:
答案 0 :(得分:15)
您有python 3.8,而不是python 3.7。
但是在pypi上没有可用于matplotlib 3.1.1的python 3.8轮子。因此,最好完全删除python 3.8并安装python 3.7。
然后,当您运行python -m pip install matplotlib
时,它将从转轮上安装编译的版本,因此无需您自己编译任何文件或使用Microsoft Studio。
答案 1 :(得分:4)
在这个问题上花了很多时间之后,这帮助我解决了这个问题:
python -m pip install -U matplotlib==3.2.0rc1
答案 2 :(得分:2)
仅供参考:matplotlib网站installation instructions上有一些有关从源代码安装的信息。
对于Windows,它指出设置包括路径和链接路径:
set CL=/IC:\directory\containing\ft2build.h ...
set LINK=/LIBPATH:C:\directory\containing\freetype.lib ...
答案 3 :(得分:2)
作为解决方法,您可以使用带有pip install <downloaded_filename>
的“ Python扩展软件包的非官方Windows二进制文件”在Windows上安装matplotlib。
在Python 3.8,Windows 10和matplotlib-3.2上进行了测试