解决python3 pip安装、更新及yaml安装

问题:python3.6版本使用pip安装第三方库时总是报错

电脑中存在多个python版本写成对应pip版本

解决:pip3 install pyOpenSSL -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

 pyOpenSSL:为要安装的包名    源地址:http://pypi.douban.com/simple

使用源更新pip版本

python3 -m pip install --upgrade pip -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

 安装yaml 

(1)安装wheel

pip3 install wheel

(2)python未集成yaml库所以要自己手动安装,官网下载对应版本yaml         https://pypi.org/project/PyYAML/#files

下载后pip安装,pip3 install C:Users39098DesktopPyYAML-5.1-cp36-cp36m-win_amd64.whl

小知识:
使用easy_install或pip安装Python第三方库时,默认源地址是:https://pypi.python.org/simple/
这是这个源有几个问题:
1.国外的网站访问速度比较慢.
2.使用该源遵循http协议,若机器上没有安装openssl或ssl配置不对,将导致easy_install或pip访问该源
失败,若想解决这两个问题,
可以使用国内的PyPI镜像源(会定期的把国外的软件拷贝到这个库中)。
国内的一些pipy的镜像源:
1.清华源: https://pypi.tuna.tsinghua.edu.cn/simple
2.豆瓣源: https://pypi.douban.com/simple

---------------------
作者:五指灵猿
来源:CSDN
原文:https://blog.csdn.net/hgdl_sanren/article/details/82858896
版权声明:本文为博主原创文章,转载请附上博文链接!

学无止境
原文地址:https://www.cnblogs.com/ALXB/p/10717305.html