python中安装numpy、pandas、scipy、matplotlib等扩展包

概述

整体思路就是找到对应的.whl文件格式的安装包,然后借助命令行工具安装即可。

正文

那么如何找到对应包的.whl文件呢?
进入网站:https://pypi.org/

python中安装numpy、pandas、scipy、matplotlib等扩展包
直接在搜索界面搜索numpy即可。
搜索结果如下:
python中安装numpy、pandas、scipy、matplotlib等扩展包
点击第一个查看,看是否为最新版本。
python中安装numpy、pandas、scipy、matplotlib等扩展包
结果显示为是最新版本
接下来就是下载对应的.whl文件了
python中安装numpy、pandas、scipy、matplotlib等扩展包
python version也就是python的版本,cp35/36/37分别指的是3.5/3.6/3.7系列的版本。我电脑安装的是3.6.6版本的,并且我的电脑是windows 64位系统,所以我下载的是这一个,如下
python中安装numpy、pandas、scipy、matplotlib等扩展包
将该文件下载下来并复制到python安装目录下的Scrips文件夹内。

python中安装numpy、pandas、scipy、matplotlib等扩展包
接下来就是进行安装了。注意:在利用pip进行安装之前一定要将Scrips文件夹路径添加到系统环境变量的path中去。否则命令行工具可能无法识别接下来的安装命令。
简单介绍一下如何添加系统环境变量:
右键我的电脑->属性->高级系统设置->环境变量->系统变量(path)->编辑->新建

python中安装numpy、pandas、scipy、matplotlib等扩展包
python中安装numpy、pandas、scipy、matplotlib等扩展包
python中安装numpy、pandas、scipy、matplotlib等扩展包
python中安装numpy、pandas、scipy、matplotlib等扩展包
系统环境变量添加完成之后,在刚刚的Scipts文件夹里面shift+鼠标右键
打开power shell命令行窗口。
python中安装numpy、pandas、scipy、matplotlib等扩展包
然后直接输入:pip install (文件名).whl
我下载的numpy包文件的文件名为:numpy-1.17.4-cp36-cp36m-win_amd64
所以我输入的命令为:
pip install numpy-1.17.4-cp36-cp36m-win_amd64.whl
之后会提示安装成功,打开python的交互式窗口,输入:
import numpy
没有任何错误提示,说明成功!

而后面的pandas、scipy、matplotlib包的安装也都是采取这样的方法。我把这几个包的最新版下载地址直接贴出来,但是随着时间的推移,我给的链接对应的包可能就不是最新版本了,那么需要你们自己去找到最新版本然后下载下来安装即可。
scipy:https://pypi.org/project/scipy/
pandas:https://pypi.org/project/pandas/#files
matplotlib:https://pypi.org/project/matplotlib/#files