Python/pip安装Matplotlib失败

2024-09-24 22:31:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经安装了python3.8,我能够完美地安装numpy和scipy。当我试图安装matplotlib时,我在命令提示符下得到这个输出。在

    building 'matplotlib.ft2font' extension
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -IC:\Python38\lib\site-packages\numpy\core\include -IC:\Python38\include -IC:\Python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/checkdep_freetype2.c /Fobuild\temp.win-amd64-3.8\Release\src/checkdep_freetype2.obj
    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\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\duket\\AppData\\Local\\Temp\\pip-install-6otudvqg\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\duket\\AppData\\Local\\Temp\\pip-install-6otudvqg\\matplotlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\duket\AppData\Local\Temp\pip-record-2fr17_ng\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

我不知道如何解决这个问题,我已经更新了pip,我也试图从一个.whl文件安装,但仍然没有骰子。在

非常感谢任何帮助。在

编辑:如果您想要完整的命令提示符输出,我在这里用它做了一个pastebin:https://pastebin.com/HNXcGrDH


Tags: includematplotlibwindowsfilesprogramwintempx86
2条回答

缺少依赖于matplotlibfreetype请看一下{a1}为{}构建所需的库。但是请注意,matplotlib的最新版本只支持python 3.7。如果使用最新版本from github,您可能仍然可以从源代码构建,但是不能保证其稳定性,特别是因为当前没有{a3}

从Gohlke教授那里下载预构建的lib并使用pip进行安装

https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

pip install matplotlib-3.1.1-cp38-cp38-win_amd64.whl

相关问题 更多 >