首页 > 解决方案 > 使用 pip 安装 matplotlib 的问题

问题描述

pip install matplotlib在 Visual Studio Code 中使用命令安装 matplotlib 时出现一些错误。这是错误状态

Running setup.py install for matplotlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\lenovo\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-ebe54zpw\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-ebe54zpw\\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\Lenovo\AppData\Local\Temp\pip-record-r6a9f5rh\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lenovo\appdata\local\programs\python\python39\Include\matplotlib'
         cwd: C:\Users\Lenovo\AppData\Local\Temp\pip-install-ebe54zpw\matplotlib\
    .
    .
    .
    UPDATING build\lib.win32-3.9\matplotlib\_version.py
    set build\lib.win32-3.9\matplotlib\_version.py to '3.3.2'
    running build_ext
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    Extracting freetype-2.6.1.tar.gz
    Building freetype in build\freetype-2.6.1
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\lenovo\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-ebe54zpw\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-ebe54zpw\\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\Lenovo\AppData\Local\Temp\pip-record-r6a9f5rh\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lenovo\appdata\local\programs\python\python39\Include\matplotlib' Check the logs for full command output.

希望得到解决方案,谢谢。。

标签: pythonmatplotlibpip

解决方案


正如你在这里看到的;

error: Microsoft Visual C++ 14.0 is required

这是你的问题。


推荐阅读