栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

Python 安装matplotlib报错解决

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python 安装matplotlib报错解决

...      
      copying libmatplotlibmpl-datafontsttfSTIXGeneralBol.ttf -> buildlib.win-amd64-3.10matplotlibmpl-datafontsttf
      UPDATING buildlib.win-amd64-3.10matplotlib_version.py
      set buildlib.win-amd64-3.10matplotlib_version.py to '3.5.2'
      running build_ext
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-buil
d-tools/
      Building freetype in buildfreetype-2.6.1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> matplotlib

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

解决:

1.查看自己的python版本和需要下载的matplotlib版本

这里查看报错的第1行和第3行

 copying libmatplotlibmpl-datafontsttfSTIXGeneralBol.ttf -> buildlib.win-amd64-3.10matplotlibmpl-datafontsttf
 set buildlib.win-amd64-3.10matplotlib_version.py to '3.5.2'

得知python版本为3.10,matplotlib 版本为 3.5.2

2. 下载对应的版本的.whl 文件

地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

我下载了  matplotlib-3.5.2-cp310-cp310-win_amd64.whl

再打开cmd,输入:

pip install matplotlib-3.5.2-cp310-cp310-win_amd64.whl

成功!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/875824.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号