【问题标题】:pip installl - skip specific dependenciespip install - 跳过特定的依赖项
【发布时间】:2020-08-18 17:01:23
【问题描述】:

pip 如何在安装所有其他依赖项时只跳过一个依赖项。 使用this topic 上回答的 --no-deps, --no-dependencies 将不起作用,因为它会阻止 all 依赖关系。

我需要跳过一个单个依赖项的原因是这个依赖项在我的环境下不兼容(我有这个依赖项的个性化版本)

【问题讨论】:

    标签: pip requirements.txt


    【解决方案1】:

    也许使用requirements.txtconstraints.txt 文件让pip 知道使用您修改后的依赖版本。这两个文件具有不同的含义和它们可以处理的不同选项,因此根据您的确切需求,其中一个可能更合适。如果可能,我建议使用constraints.txt 文件。

    答。

    # requirements.txt
    TheDependency --find-links /path/to/dir/containing/modified-dependency
    
    python -m pip install Something --requirement requirements.txt
    

    B.

    # constraints.txt
    TheDependency @ /path/to/modified-dependency-1.2.3.whl
    
    python -m pip install Something --constraint constraints.txt
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-20
      • 2014-10-31
      • 1970-01-01
      • 2021-04-11
      • 1970-01-01
      • 2016-08-21
      • 2022-08-17
      • 1970-01-01
      相关资源
      最近更新 更多