python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

目录

解决方法一:更换下载源

解决方法二:使用源码安装

解决方法三:通过whl文件安装

拓展:虚拟环境下通过源码安装第三方库


使用pip命令安装python包时可能会出现如下错误提示:

ERROR: Could not find a version that satisfies the requirement XXX (from v

ersions: none)

ERROR: No matching distribution found for XXX

WARNING: There was an error checking the latest version of pip.

解决方法一:更换下载源

考虑指定下载源并信任其来源或许能下载成功,这里使用 豆瓣下载源,也可尝试其它下载源。

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

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

解决方法二:使用源码安装

在官网PyPI · The Python Package Index搜索要下载的模块,找到Download Files,下载源码压缩包。

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

 将源码压缩包解压,Win+R打开运行窗口,输入cmd回车进入命令行,切换至源码包中setup.py所在目录,执行python setup.py install命令,即可安装成功。

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

解决方法三:通过whl文件安装

 在官网PyPI · The Python Package Index 下载whl文件。

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

将该文件放至python根目录。

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

通过在python根目录窗口输入cmd并回车打开命令窗口。

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

在打开的命令窗口中通过下方命令安装whl文件。

pip install 包名 

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

拓展:虚拟环境下通过源码安装第三方库

通过官网PyPI · The Python Package Index 下载对应的源码。

将源码拷贝至虚拟环境的Script文件夹下。

在虚拟环境下的Script下打开命令窗口(搜索栏输入cmd并回车,可参考解决方法三对应部分), 命令行输入activate并回车激活虚拟环境,此时最前方括号中显示虚拟环境名称。

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

通过cd 文件夹名并回车进入源码根目录。

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

输入命令python setup.py install并回车进行安装。

python使用pip安装包报错的解决办法(ERROR: Could not find a version that satisfies the requirement XXX)

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/3bfefa848c.html