欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > python >内容正文

python

win10如何使用pip下载适合自己python版本的matplotlib?(亲测有效)

发布时间:2025/4/5 python 50 豆豆
生活随笔 收集整理的这篇文章主要介绍了 win10如何使用pip下载适合自己python版本的matplotlib?(亲测有效) 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

文章目录

请注意:本文基于win10 64位,下面是本次需要下载的所有文件,具体过程请往下阅读。

安装完成示意图:

测试结果
test_matplotlib.py

import matplotlib.pyplot as pltsquares = [1, 4, 9, 16, 25] plt.plot(squares) plt.show()

下面是具体步骤:

第一步:进入网站(注意:所需要的东西都在这个网站!!!)https://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools

第二步:Ctrl+F打开搜索框,搜索matplot,然后找到自己python对应的版本号,见下图。点击下载即可。


第三步:将这个.whl文件复制到你的项目文件夹

第四步:按住SHIFT点击鼠标右键,点击“在此处打开Powershell窗口”。

第五步:使用pip来安装matplotlib:

pip install <安装包名>

比如

pip install .\matplotlib-3.3.4-cp38-cp38-win_amd64.whl

善于使用TAB键(在大写键上面),可以自动补全后面的文件名,比如上面的matplotlib-3.3.4-cp38-cp38-win_amd64.whl文件,只需要输入mat然后按tab键就可以自动补全。

一般情况下,会遇到错误,那么请仔细阅读下面的话:

注意,下面这句话很重要:当出现错误时,提示啥,接着回到步骤一的网站,找到对应的安装包,下载之!!!。比如这里缺少kiwisolver,那么找到它下载下来。具体情况如下。

如果提醒:

ERROR: Could not find a version that satisfies the requirement kiwisolver>=1.0.1 (from matplotlib)

接着下载之,然后移到自己的项目目录下。

使用pip install <安装包名>安装。显示安装成功之后,再重新安装matplotlib:

pip install .\matplotlib-3.3.4-cp38-cp38-win_amd64.whl

下面情况类似。


如果提醒:

ERROR: Could not find a version that satisfies the requirement cycler>=0.10 (from matplotlib) ERROR: No matching distribution found for cycler>=0.10

如果提醒:

ERROR: Could not find a version that satisfies the requirement six (from cycler) ERROR: No matching distribution found for six


如果提醒:

ERROR: Could not find a version that satisfies the requirement python-dateutil>=2.1 (from matplotlib) ERROR: No matching distribution found for python-dateutil>=2.1


如果提醒:

ERROR: Could not find a version that satisfies the requirement pillow>=6.2.0 (from matplotlib) ERROR: No matching distribution found for pillow>=6.2.0

如果提醒:

ERROR: Could not find a version that satisfies the requirement pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 (from matplotlib) ERROR: No matching distribution found for pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3

终于安装成功了!!!

第六步:输入python命令,导入包,结果如上图所示,表示成功。

import matplotlib

第七步:编写函数使用matplotlib。

test_matplotlib.py

import matplotlib.pyplot as pltsquares = [1, 4, 9, 16, 25] plt.plot(squares) plt.show()

参考:
[1]https://blog.csdn.net/shizheng_Li/article/details/114731202?spm=1001.2014.3001.5501
[2]https://blog.csdn.net/u010002387/article/details/48784707?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.control&dist_request_id=&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.control

总结

以上是生活随笔为你收集整理的win10如何使用pip下载适合自己python版本的matplotlib?(亲测有效)的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。