pip install pipreqs
Usage:
pipreqs [options] <path>
Options:
use-local Use ONLY local package info instead of querying PyPI
pypi-server <url> Use custom PyPi server
proxy <url> Use Proxy, parameter will be passed to requests library. You can also just set the
environments parameter in your terminal:
$ export HTTP_PROXY="http://10.10.1.10:3128"
$ export HTTPS_PROXY="https://10.10.1.10:1080"
debug Print debug information
ignore <dirs>... Ignore extra directories
encoding <charset> Use encoding parameter for file open
savepath <file> Save the list of requirements in the given file
print Output the list of requirements in the standard output
force Overwrite existing requirements.txt
我评论的原始答案:
您可以使用pip freeze列出所有已安装的包以及特定版本:
这将很好地工作,尤其是当您使用virtualenv时。如果不是,并且您只想列出特定项目中请求的包,请考虑@Sidon的answer。在
皮普雷克斯
pip冻结列出所有安装的包,使用pipreqs。PIPREQ生成要求.txt基于导入的任何项目的文件。在
Project on github
您可以通过运行
pip freeze > requirements.txt
来完成此操作。 我建议你在这里看一下这个link,因为它解释得很好。在pip freeze
命令按照documentation执行以下操作:因此,当运行
pip freeze > requirements.txt
时,您正在将已安装的包写入.txt
文件中。在相关问题 更多 >
编程相关推荐