【问题标题】:python requirements.txt - unexpected dependencies [duplicate]python requirements.txt - 意外的依赖项[重复]
【发布时间】:2021-10-11 05:11:28
【问题描述】:

运行后pip3 install -r requirements.txt

# requirements.txt
...

django~=3.1
djangorestframework~=3.12
django-extensions~=3.0
pygraphviz~=1.6
sphinx~=3.3
...

我看到了错误的 django 版本:

pip freeze

django==3.2.5

我想requirements.txt 中的某个包将其作为依赖项

  • 如何找到罪魁祸首?
  • 如何防止这种情况发生?

【问题讨论】:

  • 重置出厂运行时间,创建虚拟环境,然后安装需求。然后检查版本!
  • 我每次都这样做——它是 docker build 的一部分
  • 你用的是哪个编辑器?
  • 尝试在需求中使用django~=3.1.0。有关更多信息,请参阅@roganjosh 的答案。

标签: python pip


【解决方案1】:

没有问题。这正是it should work 的方式。 django~=3.13.2.5 在主要版本上没有区别。

Operator Description Example
~= Any compatible release. Compatible releases are releases that are within the same major or minor version, assuming the package author is using semantic versioning. ~=3.1: version 3.1 or later, but not version 4.0 or later. ~=3.1.2: version 3.1.2 or later, but not version 3.2.0 or later.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-24
    • 2021-04-04
    • 1970-01-01
    • 2014-07-21
    • 1970-01-01
    • 2021-12-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多