代码之家  ›  专栏  ›  技术社区  ›  stackbiz

如何在现有python环境中显示依赖关系问题

  •  0
  • stackbiz  · 技术社区  · 11 月前

    我通过以下命令在Ubuntu上安装了python包:

    # pip install --upgrade -r r.txt
    

    以下是控制台输出:

    Installing collected packages: protobuf
    
    ERROR: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.
    apache-beam 2.53.0 requires packaging>=22.0, but you'll have packaging 20.9 which is incompatible.
    ortools 9.8.3296 requires absl-py>=2.0.0, but you'll have absl-py 1.4.0 which is incompatible.
    ortools 9.8.3296 requires pandas>=2.0.0, but you'll have pandas 1.5.3 which is incompatible.
    
    Successfully installed protobuf-4.25.1
    #
    

    关闭控制台后,我想重新打开终端,检查我的系统中有什么依赖性问题。

    以下是预期输出:

    # pip what_command_to_show_the_problem
    
    ERROR: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.
    apache-beam 2.53.0 requires packaging>=22.0, but you'll have packaging 20.9 which is incompatible.
    ortools 9.8.3296 requires absl-py>=2.0.0, but you'll have absl-py 1.4.0 which is incompatible.
    ortools 9.8.3296 requires pandas>=2.0.0, but you'll have pandas 1.5.3 which is incompatible.
    

    什么命令可以用来显示相同的 dependency problem 是否存在于系统中?

    1 回复  |  直到 11 月前
        1
  •  1
  •   phd    11 月前

    命令是 pip check

    看见 the docs :

    验证已安装的程序包是否具有兼容的依赖项。

    如果你想检查虚拟环境,不要忘记激活它或运行它 python / pip 而不是基本的:

    path/to/venv/bin/python -m pip check