“找不到满足要求的版本”Django2应用程序安装错误

2024-05-10 14:50:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我是新手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
    

谨致问候


Tags: installpipthedjangofrom命令应用程序错误
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

从PyPI中删除了包certifi==2018.1.18。当前版本是certifi==2018.4.16。原因是certifi有些特殊:它只是根SSL证书的集合,因此一旦它们过时,就会发布带有新证书的certifi的新版本,出于安全原因,旧的证书将被删除,这样您就不会意外地继续安装和使用旧的、可能被吊销或损坏的证书。

您的解决方案是将确切的版本要求全部删除:

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

或者需要一个最低版本,并(可选)与包的新版本进行碰撞:

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

后者是我通常使用的方法:这样

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

相关问题 更多 >