无法在python中安装模块

时间:2019-12-21 13:20:47

标签: python matplotlib libraries

我无法在python中安装任何模块,在搞乱了很多之后,我设法只安装了numpy,但是在遵循了很多在线建议后,我却无法安装numpy。 错误显示为:

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

尝试执行pip install matplotlib

命令输出:

UPDATING build\lib.win-amd64-3.8\matplotlib\_version.py
    set build\lib.win-amd64-3.8\matplotlib\_version.py to '3.1.2'
    running build_ext
    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.24.28314\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:\Users\ziv riger\PycharmProjects\DSAlg2\venv\lib\site-packages\numpy\core\include" "-IC:\Users\ziv riger\PycharmProjects\DSAlg2\venv\include" "-IC:\Users\ziv riger\AppData\Local\Programs\Python\Python38\include" "-IC:\Users\ziv riger\AppData\Local\Programs\Python\Python38\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-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.24.28314\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

    ----------------------------------------

Command ""C:\Users\ziv riger\PycharmProjects\DSAlg2\venv\Scripts\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\ZIVRIG~1\\AppData\\Local\\Temp\\pycharm-packaging\\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\ziv riger\AppData\Local\Temp\pip-record-3cembnqt\install-record.txt" --single-version-externally-managed --compile --install-headers "C:\Users\ziv riger\PycharmProjects\DSAlg2\venv\include\site\python3.8\matplotlib"" failed with error code 1 in C:\Users\ZIVRIG~1\AppData\Local\Temp\pycharm-packaging\matplotlib\

1 个答案:

答案 0 :(得分:0)

虽然我无法弄清楚是什么原因导致的,但我从使用PyCharm移到了Visual Studio,然后将库导入那里工作正常。