requirements.txt 文件中的依赖项在使用正确版本时会产生冲突

Dependencies in requirements.txt file creates a conflic when using correct version

当我 运行 我的 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

两个依赖的写法如下:

但我最困惑的是错误消息部分说:djangorestframework-jwt 1.11.0 depends on PyJWT<2.0.0 and >=1.5.2

PyJWT 版本 2.0.0 不够好吗?

这种冲突真是让人头疼。 Pip 说版本必须在 PyJWT<2.0.0 and >=1.5.2 之间,所以你可以使用确切的 2.0.0.

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