自动创建requirements.txt [英] Automatically create requirements.txt

查看:112
本文介绍了自动创建requirements.txt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我从 github 下载python源代码,但不知道如何安装所有依赖项。如果没有 requirements.txt 文件,我必须手动创建它。
问题是:
给定python源代码目录,是否可以从导入部分自动创建 requirements.txt

Sometimes I download the python source code from github and don't know how to install all the dependencies. If there is no requirements.txt file I have to create it by hands. The question is: Given the python source code directory is it possible to create requirements.txt automatically from the import section?

推荐答案

如果使用虚拟环境, pip冻结> requirements.txt 很好。 如果不是 pigar 将是您的理想选择。

If you use virtual environment, pip freeze > requirements.txt just fine. IF NOT, pigar will be a good choice for you.

顺便说一句,我不确定它是否可以在2.6版上使用。

By the way, I do not ensure it will work with 2.6.

更新

Pipenv 或其他工具来改善您的开发流程。

Pipenv or other tools is recommended for improving your development flow.

对于 Python 3 ,请在下面使用

pip3 freeze > requirements.txt

这篇关于自动创建requirements.txt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆