简体   繁体   English

无法再使用pip安装旧版本

[英]Can't install old versions with pip anymore

I'n using pip 1.5.1 which worked fine up until today. 我使用的pip 1.5.1到目前为止一直工作良好。

Now, I'm trying to install a requirements.txt in a fresh virtualenv, and for many packages it can no longer find specific old version for most packages. 现在,我正在尝试在新的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

What do I need to do to get this to work again? 我需要怎么做才能使它再次起作用? Upgrading my app to use all the latest versions of all its packages is out of the question. 毫无疑问,要升级我的应用程序以使用所有软件包的所有最新版本。

Update: This works fine in pip 1.4.1. 更新:这在1.4.1中有效。 It's the newer version of pip that's causing it to fail. 这是pip的较新版本,导致其失败。

From PIP 1.5 changelog : PIP 1.5更新日志

BACKWARD INCOMPATIBLE 向后不兼容

pip no longer will scrape insecure external urls by default nor will it install externally hosted files by default. pip不再默认会刮擦不安全的外部url,也不会默认安装外部托管的文件。 Users may opt into installing externally hosted or insecure files or urls using --allow-external PROJECT and --allow-unverified PROJECT 用户可以选择使用--allow-external PROJECT--allow-unverified PROJECT安装外部托管的或不安全的文件或URL。

So in this case following ought to work the same way as old PIP: 因此,在这种情况下,以下操作应与旧的PIP相同:

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

(There is no --allow-all-unverified , each unverified project name must be specified) 没有--allow-all-unverified ,必须指定每个未验证的项目名称)

In case of using requirements.txt , it should be specified like this: 如果使用requirements.txt ,则应这样指定:

--allow-external django-endless-pagination
--allow-unverified django-endless-pagination

django-endless-pagination==1.1

In this case, you can use the URL of the appropriate zip file as input to pip install :: 在这种情况下,您可以使用适当的zip文件的URL作为pip install ::的输入:

pip install https://github.com/frankban/django-endless-pagination/archive/v1.1.zip

Of course, not every package will have such a URL available, but most do. 当然,并非每个软件包都会有这样的URL可用,但是大多数都可以。

I've occasionally used this to install the latest-greatest master, since in some cases the cheeseshop didn't have Python 3 ready packages yet. 我偶尔会用它来安装最新的master,因为在某些情况下,cheeseshop还没有Python 3就绪软件包。

因为PyPI上的版本是2.0,并且pip现在尝试尊重维护者希望您使用给定版本的事实。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM