[英]Can't install matplotlib : fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory
I'm trying to install the matplotlib module but when I try to do so I get an error, that being pretty big but it seems to be due to a missing file, ft2build.h我正在尝试安装 matplotlib 模块,但是当我尝试这样做时,我收到一个错误,它非常大,但似乎是由于缺少文件 ft2build.h
What can I do to fix this?我能做些什么来解决这个问题?
Here is the error code I get (I've had to remove part of the error message as it was too big, I removed the part where files were copied and some created):这是我得到的错误代码(我不得不删除部分错误消息,因为它太大了,我删除了复制文件并创建了一些文件的部分):
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Maca\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Maca\\AppData\\Local\\Temp\\pip-install-8fraia6a\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Maca\\AppData\\Local\\Temp\\pip-install-8fraia6a\\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\Maca\AppData\Local\Temp\pip-record-1miy2gd_\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\Maca\AppData\Local\Temp\pip-install-8fraia6a\matplotlib\
Complete output (505 lines):
================================================================================
Edit setup.cfg to change the build options
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]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
tests: no [skipping due to configuration]
OPTIONAL BACKEND EXTENSIONS
agg: yes [installing]
tkagg: yes [installing; run-time loading from Python Tcl/Tk]
macosx: no [Mac OS-X only]
OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]
UPDATING build\lib.win32-3.8\matplotlib\_version.py
set build\lib.win32-3.8\matplotlib\_version.py to '3.1.1'
running build_ext
building 'matplotlib.ft2font' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
D:\Program Files\Microsoft Visual Studio\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86\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:\Users\Maca\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\core\include -IC:\Users\Maca\AppData\Local\Programs\Python\Python38-32\include -IC:\Users\Maca\AppData\Local\Programs\Python\Python38-32\include "-ID:\Program Files\Microsoft Visual Studio\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-ID:\Program Files\Microsoft Visual Studio\VC\Tools\MSVC\14.15.26726\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /Tcsrc/checkdep_freetype2.c /Fobuild\temp.win32-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 'D:\\Program Files\\Microsoft Visual Studio\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Maca\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Maca\\AppData\\Local\\Temp\\pip-install-8fraia6a\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Maca\\AppData\\Local\\Temp\\pip-install-8fraia6a\\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\Maca\AppData\Local\Temp\pip-record-1miy2gd_\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
Download your file to a folder on your C drive.将文件下载到 C 驱动器上的文件夹中。 In windows CMD prompt as Administrator navigate you your path using cd.. or cd wheels (in my case I saved the file to c:\Wheels) then type pip
install YourFilename.whl In windows CMD prompt as Administrator navigate you your path using cd.. or cd wheels (in my case I saved the file to c:\Wheels) then type pip
install YourFilename.whl
At the time the version of python I installed was quite new, therefore didnt quite have the support for the module at this point.当时我安装的python的版本比较新,所以目前对模块还不太支持。 As pointed out by Talha Junaid.正如 Talha Junaid 指出的那样。 I have also encountered a similar issue with multiple other modules from time to time, though not necessarily in this form of error.我也时常遇到与其他多个模块类似的问题,尽管不一定是这种形式的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.