gpt4 book ai didi

python - 有没有办法在python中获取目录包依赖项?

转载 作者:行者123 更新时间:2023-12-04 09:08:21 24 4
gpt4 key购买 nike

我知道 pip freeze > requirements.txt存在,但它会打印出我的系统包,其中只有几个我的目录/项目需要。
我没有使用 virtualenv所以我很确定我不能打印出这样的本地包。
我也知道pipdeptree存在,但我也不明白这如何解决我的问题?

最佳答案

我相信像下面这样的工具会有所帮助:

  • pipreqs
  • pigar

  • 据我所知,这些工具读取目录中的代码,并根据它们在代码中找到的导入语句尝试找出所需的依赖项。
    有关的:
  • https://stackoverflow.com/a/61202584/11138259
  • https://stackoverflow.com/a/61540466/11138259
  • How to generate requirements.txt for given py-sources folder or specific py file?
  • https://stackoverflow.com/a/31684470/11138259
  • 关于python - 有没有办法在python中获取目录包依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63404353/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com