pip install 第三方库报错

报错 :Could not find a version that satisfies the requirement xlrd (from versions: )

No matching distribution found for xlrd

这是因为网络的问题,需要使用国内的镜像源来加速,比如豆瓣源

方式一:

命令改为:

pip install xlrd http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

或者

pip3 install xlrd http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

方案二:

设置延迟时间

命令:pip --default-timeout=100 install xlrd pip

方案三:

在pip安装路径下,创建python文件(.py)

import os  

ini="""[global] 
index-url = https://pypi.doubanio.com/simple/ 
[install] 
trusted-host=pypi.doubanio.com 
"""  
pippath=os.environ["USERPROFILE"]+"\pip\"  

if not os.path.exists(pippath):  
    os.mkdir(pippath)  

with open(pippath+"pip.ini","w+") as f:  
    f.write(ini)  

  在cmd上运行这个python文件,之后再用pip install命令安装速度非常快。

原文地址:https://www.cnblogs.com/dudubao/p/9494092.html