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,来整个图

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

二、原因

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

三、解决办法

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

这里用的是阿里云镜像源

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

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

其它镜像源:

清华镜像源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

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
社会演员多的头像社会演员多普通用户
上一篇 2023年3月10日
下一篇 2023年3月10日

相关推荐