简体   繁体   English

如何列出特定文件夹/包的所有 Python 要求?

[英]How can I list all Python requirements for a specific folder/package?

I have been working on a project for some time, writing Python scripts spontaneously as I needed them.我已经在一个项目上工作了一段时间,在需要时自发地编写 Python 脚本。 I'd like to pick out some important ones and put them neatly into a package and then a git repository in a way which makes it easy for co-workers to use them.我想挑出一些重要的,把它们整齐地放在一个包里,然后放在一个 git 存储库中,以方便同事使用它们。 How can I find out all required Python packages for this specific collection of scripts (which is now a package itself), so I can list them in a requirements.txt ?我如何才能找到这个特定脚本集合(现在是一个包本身)所需的所有 Python 包,以便我可以在requirements.txt列出它们? I read up on pip freeze , but this will list everything in the current virtual environment, more than is needed by the scripts I have collected in my new package.我阅读了pip freeze ,但这将列出当前虚拟环境中的所有内容,比我在新包中收集的脚本所需的要多。

There is a module called pipreqs有一个名为 pipreqs 的模块

**pip install pipreqs **pip 安装 pipreqs

pipreqs /GitHub/FolderName** pipreqs /GitHub/FolderName**

Reference : https://pypi.org/project/pipreqs/参考: https : //pypi.org/project/pipreqs/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM