简体   繁体   English

无法在python中安装模块

[英]Can't install modules in python

I can't install any module in python, after messing around with it a lot i managed to only install numpy but i cant get it to install matplotlib after following a lot of the suggestions online.我无法在 python 中安装任何模块,在搞砸了很多之后,我设法只安装了 numpy,但是在遵循了很多在线建议之后,我无法让它安装 matplotlib。 the errors shows as:错误显示为:

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

when trying to execute pip install matplotlib尝试执行pip install matplotlib

the command output:命令输出:

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\

虽然我无法弄清楚是什么导致了问题,但我从使用 PyCharm 转移到了 Visual Studio 并在那里导入库工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM