pip搜索和pip安装出现错误



嗨,这是大约两天我得到这个错误:

错误:XMLRPC请求失败[code:-32500]RuntimeError: PyPI的XMLRPC API目前由于无法管理的负载而被禁用,并将在不久的将来弃用。更多信息请参见https://status.python.org/。

我问了一些人,搜索了很多,但我不知道是什么问题,如何解决它我尝试了pip自己推荐的apt updatepython3 pip install --upgrade pip我在android使用TermuxPIP工作了几天了…

遗憾的是pip search现在被python.org永久禁止了。
他们说他们"每小时接到数十万个搜索电话";100天(自2020年11月14日起),并且在此发生之前,搜索调用所通过的XMLRPC API已经被确定为已弃用。
所以也许我们需要直接在pypi.org上搜索包,或者转向像pypi-simple-search或pipsearch这样的包。

对于基于包名模式的搜索,我在下面分享了这个脚本,希望它对你有用。

#!/bin/bash
# pypi-search.sh 
# This script fetch data from https://pypi.org/simple/ 
# process the output for simple package name output with perl
# and then apply a regex pattern to the result
pypiurl=https://pypi.org/simple/
currentdate=$(date +%y%m%d)
cachedir=~/.cache/simple-pypi
[[ -d $cachedir ]] || mkdir -p $cachedir
cachefile=$(ls -1 $cachedir/*_simple-pypi.html 2>/dev/null | sort | head -n1)
[[ $cachefile = "" ]] && cachefile=$cachedir/"${currentdate}_simple-pypi.html"
searchpattern="$1"
cmd="$2"
if [[ -f $cachefile ]] ; then
dbdate=$(echo $cachefile | grep -Po "[0-9]{6,6}")
# if db is older than 3 days or second parameter is 'update'
( (( ($currentdate - $dbdate) > 3 )) || [[ "x$cmd"  = 'xupdate' ]] ) && {
echo "last update was on : $dbdate"
cachefile=$cachedir/"${currentdate}_simple-pypi.html"
wget -q --show-progress -O - $pypiurl > $cachefile
}
else
wget -q --show-progress -O - $pypiurl > $cachefile
fi
[[ x$searchpattern = "x" ]] && read -p "Enter pypi name pattern : " searchpattern
perl -pe 's/.*([/"]{1,1}>){1,1}([^>]+(.*)[^<])+</a>/2/g' $cachefile | grep -P "$searchpattern"

用法:pypi-search.sh ^ pip $

如果您遵循链接,在上次更新中他们声明XMLRPC API被禁用(由于流量过大)。这意味着pip search当前被禁用。上次更新是一个月前发布的,我看不到任何变化。

最新更新