【问题标题】:Dependencies in requirements.txt file creates a conflic when using correct version使用正确版本时,requirements.txt 文件中的依赖项会产生冲突
【发布时间】:2022-01-15 00:47:26
【问题描述】:

当我运行我的 requirements.txt 文件时,我收到以下错误消息

ERROR: Cannot install PyJWT==2.0.0 and djangorestframework-jwt==1.11.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested PyJWT==2.0.0
    djangorestframework-jwt 1.11.0 depends on PyJWT<2.0.0 and >=1.5.2
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

两个依赖的写法如下:

  • PyJWT==2.0.0
  • djangorestframework-jwt==1.11.0

但我最困惑的是错误消息部分说:djangorestframework-jwt 1.11.0 依赖于 PyJWT=1.5.2

PyJWT 2.0.0 版还不够好吗?

【问题讨论】:

  • 错误:无法安装 PyJWT==2.0.0 和 djangorestframework-jwt==1.11.0,因为这些软件包版本具有冲突的依赖项。冲突是由以下原因引起的:用户请求 PyJWT==2.0.0 djangorestframework-jwt 1.11.0 依赖于 PyJWT=1.5.2 要解决此问题,您可以尝试: 1. 放宽包版本的范围您已指定 2. 删除软件包版本以允许 pip 尝试解决依赖冲突错误:ResolutionImpossible:寻求帮助,请访问pip.pypa.io/en/latest/user_guide/…

标签: python dependencies version dependency-management


【解决方案1】:

这种冲突让人头疼。 Pip 说版本必须在PyJWT&lt;2.0.0 and &gt;=1.5.2 之间,所以你可以使用精确的2.0.0

将其降级为PyJWT==1.7.1,它应该可以工作!

【讨论】:

  • 我收到以下错误错误:无法安装 -r requirements.txt(第 53 行)、PyJWT==1.7.1 和 djangorestframework-simplejwt==5.0.0,因为这些软件包版本具有冲突的依赖项。冲突的原因是:用户请求 PyJWT==1.7.1 djangorestframework-jwt 1.11.0 依赖于 PyJWT=1.5.2 djangorestframework-simplejwt 5.0.0 依赖于 pyjwt=2
  • 在您的 requirements.txt 中,djangorestframework-simplejwt 的版本是 1.11.0 还是 5.0.0?将其设为1.11.0,并将PyJWT 设为1.7.1,应该没问题。
猜你喜欢
  • 2023-01-02
  • 2023-04-03
  • 2012-05-30
  • 1970-01-01
  • 1970-01-01
  • 2021-06-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多