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

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

问题描述

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

解决方案

使用 建议使用 Pipenv 或其他工具来改进您的开发流程.

pip3 冻结 >requirements.txt # Python3点冻结>requirements.txt # Python2

如果你不使用虚拟环境,pigar 会是你不错的选择.p>

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?

解决方案

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

pip3 freeze > requirements.txt  # Python3
pip freeze > requirements.txt  # Python2

If you do not use a virtual environment, pigar will be a good choice for you.

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

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