【问题标题】:"Could not find a version that satisfies the requirement" error for Django2 app installationDjango2 应用程序安装的“找不到满足要求的版本”错误
【发布时间】:2018-10-20 07:46:09
【问题描述】:

我是新手 Python/Django 程序员。

我基于Django 2.0创建了一个应用程序,并按照the official document打包。 然后我运行命令:

$ pip install --user django-easybuggy-0.1.tar.gz

但是,我收到错误消息,无法安装。

Processing ./django-easybuggy-0.1.tar.gz
Collecting certifi==2018.1.18 (from django-easybuggy==0.1)
  Could not find a version that satisfies the requirement certifi==2018.1.18 (from django-easybuggy==0.1) (from versions: )
No matching distribution found for certifi==2018.1.18 (from django-easybuggy==0.1)

有谁知道错误发生的原因以及如何解决?

另外,我通过命令创建了requirements.txt

$ pip freeze > requirements.txt

重现步骤:

  1. 下载我的应用存档:

    $ wget https://github.com/k-tamura/easybuggy4django/releases/download/0.0.1/django-easybuggy-0.1.tar.gz
    
  2. 运行命令:

    $ pip install --user django-easybuggy-0.1.tar.gz
    

最好的问候,

【问题讨论】:

  • 你是什么pip 版本? pip -V 可能与 this 相关
  • 感谢您的评论。 $ pip -V 显示:pip 10.0.1 from /home/tamura/PycharmProjects/practice3/venv/lib/python3.5/site-packages/pip (python 3.5)

标签: python django python-3.x pip setuptools


【解决方案1】:

certifi==2018.1.18 已从 PyPI 中删除。当前版本是certifi==2018.4.16。原因是certifi 有点特殊:它只是根 SSL 证书的集合,所以一旦它们变得陈旧并且带有新证书的 certifi 的新版本发布,旧的证书就会被删除出于安全原因 - 这样您就不会意外地继续安装和使用旧的和可能被撤销或受损的证书。

您的解决方案是完全放弃确切的版本要求:

setup(
    ...
    install_requires=['certifi'],
    ...
)

或者需要一个最小版本并且(可选地)用你的包的新版本来提升它:

setup(
    ...
    install_requires=['certifi>=2018.4.16'],
    ...
)

后者是我常用的:这样,

  1. 你总是知道你测试过的需求的最低版本(因此知道你的包可以很好地适应它),
  2. 如果用户碰巧安装了旧版本的certifi,在安装您的软件包时它将自动升级到当前最新版本。

【讨论】:

  • 感谢您的回答。您的回答可能是我的问题的解决方案之一,但它不能应用于我的案例(投票+1)。
【解决方案2】:

我可以通过添加选项来解决我的问题:

--proxy=http://[proxy_user_id]:[proxy_user_password]@[proxy_host]:[proxy_port]/ --trusted-host pypi.python.org  --trusted-host pypi.org  --trusted-host files.pythonhosted.org

pip install

【讨论】:

    猜你喜欢
    • 2018-02-18
    • 2021-02-21
    • 1970-01-01
    • 2021-10-19
    • 2019-10-17
    • 2021-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多