【问题标题】:is there a way to list all dependancies that being used for the specific project in Python有没有办法列出用于 Python 中特定项目的所有依赖项
【发布时间】:2020-10-01 09:55:58
【问题描述】:

我刚刚用 Python 完成了这个项目。我需要添加requirements.txt。有没有办法在命令行中列出我一直在使用的所有依赖项及其版本?

我已经研究过,但看起来我需要手动完成每一个,我想知道是否有更好的方法来完成这个?

谢谢。

【问题讨论】:

  • 执行此操作的最佳方法是随时添加它们。您是否在虚拟环境中工作? pip freeze > requirements.txt 应该给你一个起点,但你可能会在那里得到一堆你并不真正需要的东西。
  • 这能回答你的问题吗? List dependencies in Python

标签: python import dependencies requirements


【解决方案1】:

为此,您需要输入以下命令pip/pip3 freeze

之后,您可以将依赖项复制到requirements.txt 文件中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-24
    • 2016-07-31
    • 2012-05-12
    • 1970-01-01
    • 2020-12-03
    • 2015-03-16
    • 1970-01-01
    • 2018-05-02
    相关资源
    最近更新 更多