如何在整个项目中处理python依赖项? [英] How to handle python dependencies throughout the project?

查看:66
本文介绍了如何在整个项目中处理python依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们说一个开发人员在意识到自己需要使用某些程序包时正在从事一个项目.他使用pip进行安装.现在,安装后,开发人员是否可以将其作为依赖项记录在 requirements 文件/ setup.py 中?

Lets say a developer is working on a project when he realizes he needs to use some package. He uses pip to install it. Now, after installing it, would a the developer write it down as a dependency in the requirements file / setup.py?

如果同一位开发人员忘记写下项目的所有依赖项(或者如果他由于从事了很长时间而没有更好的了解),他会怎么做?

What does that same dev do if he forgot to write down all the dependencies of the project (or if he didn't know better since he hasn't been doing it long)?

我要问的是使用PyPi的外部软件包时的工作流程是什么?

What I'm asking is what's the workflow when working with external packages from the PyPi?

推荐答案

命令:

pip freeze > requirements.txt 

会将python环境中当前存在的所有依赖项复制到requirements.txt中. http://pip.readthedocs.org/en/latest/reference/pip_freeze.html

will copy all of the dependencies currently in your python environment into requirements.txt. http://pip.readthedocs.org/en/latest/reference/pip_freeze.html

这篇关于如何在整个项目中处理python依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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