如何在整个项目中处理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