Skip to main content
 首页 » 编程设计

python之无法再使用 pip 安装旧版本

2025年05月04日17kenshinobiy

我使用的是 pip 1.5.1,直到今天它都运行良好。

现在,我正在尝试在新的 virtualenv 中安装 requirements.txt,对于许多软件包,它不再能为大多数软件包找到特定的旧版本。

$ pip install django-endless-pagination==1.1  
Downloading/unpacking django-endless-pagination==1.1 
  Could not find a version that satisfies the requirement django-endless-pagination==1.1 (from versions: 2.0) 
  Some externally hosted files were ignored (use --allow-external to allow). 
Cleaning up... 
No distributions matching the version for django-endless-pagination==1.1 

我需要做什么才能让它再次工作?升级我的应用程序以使用其所有软件包的所有最新版本是不可能的。

更新: 这在 pip 1.4.1 中工作正常。是较新版本的 pip 导致它失败。

请您参考如下方法:

来自 PIP 1.5 changelog :

BACKWARD INCOMPATIBLE

pip no longer will scrape insecure external urls by default nor will it install externally hosted files by default. Users may opt into installing externally hosted or insecure files or urls using --allow-external PROJECT and --allow-unverified PROJECT

所以在这种情况下,下面的工作方式应该与旧 PIP 相同:

pip install django-endless-pagination==1.1 \ 
--allow-all-external --allow-unverified django-endless-pagination  

(有no --allow-all-unverified,必须指定每个未验证的项目名称)

如果使用requirements.txt,应该这样指定:

--allow-external django-endless-pagination 
--allow-unverified django-endless-pagination 
 
django-endless-pagination==1.1