使用Pip 1.5安装外部未验证包

1 投票
3 回答
2986 浏览
提问于 2025-04-18 06:17

我正在尝试在Ubuntu 14.04上使用Python 2.7.6和pip 1.5.5安装django-admin-tools 0.5.1。

我首先尝试了:

$ pip install django-admin-tools==0.5.1
Downloading/unpacking django-admin-tools==0.5.1
  Could not find a version that satisfies the requirement django-admin-tools==0.5.1 (from versions: 0.4.0)
  Some externally hosted files were ignored (use --allow-external to allow).
Cleaning up...
No distributions matching the version for django-admin-tools==0.5.1
Storing debug log for failure in /tmp/tmpd5Tb2I

在文档中,'pip help install'提到:

 --allow-external <package>  Allow the installation of externally hosted files

我尝试启用那个标志:

$ pip install --allow-external django-admin-tools==0.5.1                                                                                                                 
You must give at least one requirement to install (see "pip help install")

这有点奇怪。经过一些小调整,我发现外部包的链接不是https的(setup.py)。所以我尝试使用标志--allow-unverified

$ pip install --allow-external --allow-unverified django-admin-tools==0.5.1                                                                                              
Downloading/unpacking django-admin-tools==0.5.1
  Could not find a version that satisfies the requirement django-admin-tools==0.5.1 (from versions: 0.4.0)
  Some externally hosted files were ignored (use --allow-external to allow).
Cleaning up...
No distributions matching the version for django-admin-tools==0.5.1
Storing debug log for failure in /tmp/tmpoT1_tW

我是不是用错了?有什么办法可以解决这个问题,使用pip安装django-admin-tools?

3 个回答

0

我找到了这个问题的解决办法:

$ pip install django-admin-tools==0.5.1 --allow-unverified django-admin-tools

相关的错误报告可以在这里查看 #1814 - pip

3

这两个选项 --allow-unverified--allow-external 都需要你提供一个包的名字作为参数。

From pip help install:
--allow-external <package>   Allow the installation of a package even if it
                             is externally hosted
--allow-unverified <package> Allow the installation of a package even if it 
                             is hosted in an insecure and unverifiable way

所以你可以这样使用:

pip install <pkg> --allow-unverified <pkg> --allow-external <pkg>

或者有点让人困惑的方式:

pip install --allow-unverified <pkg> --allow-external <pkg> <pkg>

6

试着调用:

pip install django-admin-tools==0.5.1 --allow-external django-admin-tools --allow-unverified django-admin-tools

撰写回答