如何解决legacy-install-failure错误?

Aks*_*war 9 python matplotlib

 building 'matplotlib.ft2font' extension\n      \nerror: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": <https://visualstudio.microsoft.com/visual-cpp-build-tools/>\n      [end of output]\n\n  note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: legacy-install-failure\n\n\xc3\x97 Encountered error while trying to install package.\n\xe2\x95\xb0\xe2\x94\x80> matplotlib\n\nnote: This is an issue with the package mentioned above, not pip.\nhint: See above for output from the failure\n
Run Code Online (Sandbox Code Playgroud)\n

小智 5

您需要下载Microsoft C++ Build Tools 并将其安装在系统中,然后选择Workloads并选中Desktopdevelopment using C++选项。完成后,您可以再次运行安装命令。

\n

或者

\n

您还可以选择从\n Python 扩展包的非官方 Windows 二进制文件下载此 Python 库

\n
    \n
  1. 下载名为pip install matplotlib\xe2\x80\x913.5.1\xe2\x80\x91cp38\xe2\x80\x91cp38\xe2\x80\x91win_amd64.whl \n屏幕截图
  2. \n
  3. 下载文件后,在该文件夹中打开 cmd并运行\n命令:
  4. \n
  5. pip install matplotlib\xe2\x80\x913.5.1\xe2\x80\x91cp38\xe2\x80\x91cp38\xe2\x80\x91win_amd64.whl
  6. \n
\n

类似的答案

\n


小智 5

在此输入图像描述

您需要下载 Microsoft C++ Build Tools 并将其安装在系统中,然后选择 Workloads 并选中 Desktopdevelopment using C++ 选项。

pip install -r 要求.txt