Python pip install 安装包报错ERROR: Could not find a version that satisfies the requirement XXX解决方法

Python pip install 安装包报错ERROR: Could not find a version that satisfies the requirement XXX解决方法

一、问题

使用 pip 安装 python 包时,经常会出现如下错误:

ERROR: Could not find a version that satisfies the requirement xxxx(from versions: none)
ERROR: No matching distribution found for xxxx

本次在用pip命令(pip install pdf2word)安装pdf2docx包的时候出错

因为后来安装好了,所以故意安装一个错误的pdf2word,来整个图

在这里插入图片描述

二、原因

可能是国内网络不稳定,直接导致报错,而不是环境冲突。报错信息看起来容易把人误导到解决包环境问题。

三、解决办法

直接选用稳定的pip源并且信任它的来源就可以解决这种问题

这里用的是阿里云镜像源

pip install pdf2docx -i http://mirrors.aliyun.com/simple/ --trusted-host mirrors.aliyun.com

在这里插入图片描述

其它镜像源:

清华镜像源 https://pypi.tuna.tsinghua.edu.cn/simple
中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple
豆瓣 http://pypi.douban.com/simple/

使用方法:

例如,豆瓣

pip install 包名 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

注意:
如果你的环境里还有python的其他版本,要区分pip和pip3

猜你喜欢

转载自blog.csdn.net/ArsenLupin/article/details/128212836