win10、VSCode、python3数据科学库

  首先看一下cmd能不能使用pip(一般安装了python都自带安装pip的),不能就把pip的位置加入环境变量电脑的Path里面。不过我加了环境变量还是没有用,所以只能进入pip的位置运行(我的原因找到了,因为环境变量的path里有单独的条目额外添加了分号“;”,把它去掉就可以了。不仅仅是python的path,任意的单独条目后面都不能有多余的分号)。这是我的位置,我是在VS2019上装的python,所以python的目录在VS下面,然后在python目录的scripts下有pip。

  这里有三个pip:pip、pip3和pip3.7,在python3下这三个是一样的。

  找到位置,在cmd里面进入这里,就能运行pip了(如果环境变量加了有用的话,不需要进这里就能用)

  然后安装库文件,用的是豆瓣的镜像源,如果慢可以换别的,代码如下(我这里加了--user是安装在系统用户下,而不是安装在整个系统内。因为不加--user会报错,原因可能和权限有关,就不细细研究了):

pip install --user matplotlib -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #画坐标图
pip install --user numpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #矩阵运算
pip install --user pandas -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #大型数据运算
pip install --user seaborn scipy  -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #封装的,更容易画坐标图的库,基于上面第一个matplotlib
pip install --user jupyter -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #可以分段、实时运行代码
pip install --user tensorflow --upgrade -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #深度学习库
pip install --user scipy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #数值计算库
pip install --user keras -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #深度学习库(易上手)
pip install --user pydotplus -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #画流程图
pip install --user bs4 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #爬虫解析库,有时爬爬当玩具玩
pip install --user openpyxl -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #读写Excel,07之后的excel,速度较慢
pip install --user xlrd -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #读Excel,07之前的excel,速度较快
pip install --user xlwt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #写Excel,07之前的excel,速度较快
pip install --user sklearn  -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #机器学习库
pip install --user hyperopt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #机器学习自动搜索超参数库
pip install --user hyperas -i http://pypi.douban.com/simple --trusted-host pypi.douban.com #将hyperopt与keras集成,搜索keras神经网络超参数

  安装pydotplus之前需要先安装graphviz,下载双击安装,然后将它的根目录和bin目录加到环境变量path中。

  安装成功!如果pip版本有更新,会出现警告,可以无视。我更新后就报错不能用了,后面又卸载了重装旧版本才行。

  其它镜像源: 

  清华:https://pypi.tuna.tsinghua.edu.cn/simple
  阿里云:http://mirrors.aliyun.com/pypi/simple/
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  华中理工大学:http://pypi.hustunique.com/
  山东理工大学:http://pypi.sdutlinux.org/ 

原文地址:https://www.cnblogs.com/qizhou/p/12179835.html