windows下python 3.9 Numpy scipy和matlabplot的安装

学习python过程中想使用python的matlabplot绘图功能,遇到了一大批问题,然后一路过关斩将,最终安装成功,实为不易,发帖留念。

1 首先打开cmd

win+r

2 pip安装

pip3 install --user numpy scipy matplotlib

–user 选项可以设置只安装在当前的用户下,而不是写入到系统目录。默认情况使用国外线路,国外太慢,我们使用清华的镜像就可以:

pip3 install numpy scipy matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple

如何网络不好,我们可以挨个单独安装

pip3 install numpy s -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install scipy -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple

3 安装matlabplot时遇到错误:

Using legacy 'setup.py install' for matplotlib, since package 'wheel' is not installed.
Installing collected packages: matplotlib
    Running setup.py install for matplotlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\diouf.guo\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Diouf.Guo\\AppData\\Local\\Temp\\pip-install-thjn2jbc\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Diouf.Guo\\AppData\\Local\\Temp\\pip-install-thjn2jbc\\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\Diouf.Guo\AppData\Local\Temp\pip-record-kay5nve4\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\diouf.guo\appdata\local\programs\python\python39\Include\matplotlib'

在这里插入图片描述
查看自己的python版本:

Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information.

在这里插入图片描述
我的python是3.9 AMD64

在https://www.lfd.uci.edu/~gohlke/pythonlibs/网站找到worldcould
在这里插入图片描述
选着自己相应的.whl下载。我的选:

wordcloud-1.8.0-cp39-cp39-win_amd64.whl

然后回到cmd

4 安装

pip install wordcloud-1.8.0-cp39-cp39-win_amd64.whl

在这里插入图片描述

5 再次出现错误

Using legacy 'setup.py install' for matplotlib, since package 'wheel' is not installed.

直接安装wheel

pip install wheel

6 再次安装matlabplot

pip3 install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple

不成功

7 在https://www.lfd.uci.edu/~gohlke/pythonlibs/找到matlabplot

在这里插入图片描述
下载后安装,

pip3 install matplotlib-3.3.2-cp39-cp39-win_amd64.whl

在这里插入图片描述
显示安装成功,赶紧找个程序来试一下:

import numpy as np 
from matplotlib import pyplot as plt 
 
x = np.arange(1,11) 
y =  2  * x +  5 
plt.title("Matplotlib demo") 
plt.xlabel("x axis caption") 
plt.ylabel("y axis caption") 
plt.plot(x,y) 
plt.show()

在这里插入图片描述
安装成功,一波五折

  • 9
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
根据引用和引用的内容,您提到的问题是关于Python 3.9安装scipy的问题。根据引用的信息,scipy 1.1.0版本是在Python 3.9之前发布的,因此不能直接通过pip安装。根据引用的信息,您当前使用的是Python 3.9.0版本。 要解决这个问题,您可以尝试以下几个方法之一: 1. 使用Python 3.8或更早版本: 由于scipy 1.1.0版本不支持Python 3.9,您可以考虑降级到Python 3.8或更早版本,然后再通过pip安装scipy。 2. 等待更新的scipy版本: 如果您想继续使用Python 3.9,并且需要使用scipy,您可以等待scipy发布适用于Python 3.9的新版本。 3. 编译源码安装: 如果您有一定的编译经验,您可以尝试从源码编译和安装scipy。这需要一些额外的步骤和依赖项,但可以在不受Python版本限制的情况下安装scipy。 请注意,以上方法都有一定的限制和风险,具体取决于您的实际需求和技术能力。建议您根据自己的情况选择最适合的解决方案。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [windowspython 3.9 Numpy scipymatlabplot安装](https://blog.csdn.net/baidu_34971492/article/details/109603041)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [[python]python3.9无法编译scipy1.1.0](https://blog.csdn.net/weixin_44145782/article/details/124618885)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LEEE@FPGA

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值