apt-get 的需求文件,类似于 pip [英] Requirements file for apt-get, similar to pip

查看:32
本文介绍了apt-get 的需求文件,类似于 pip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢您如何管理具有 pip 要求的依赖项.apt-get 有没有类似的东西?

I like how you can manage dependencies with pip requirements. Is there something similar in case of apt-get?

http://www.pip-installer.org/en/latest/requirements.html#requirements-file-format

推荐答案

您的问题是您希望在一个文件中包含系统依赖项列表,以便能够使用一个命令进行安装.

Your question is that you want to have a list of system dependences in one file, for being able to install it with one command.

我不建议您在系统依赖项中包含包的版本.在诸如build-essential"或uuid-dev"之类的软系统依赖项中,您通常需要最新版本的软件包.在像 python、postgres 或其他什么的硬依赖"中,通常版本在包本身的名称中指定,例如python2.6-dev"或postgresql-8.4".您可能在定义包的确切版本时遇到的另一个问题是,postgresql-8.4 的 8.4.11-1 版本可能在三个月或一年后无法在存储库中使用,而您将最终在 repo 中安装当前版本.

I don't recomend you to include the version of a package in the system dependencies. In the soft system dependences like "build-essential" or "uuid-dev" you normally want the latest version of the package. In the "hard dependeces" like python, postgres or whatever, normally the version is specified in the name of the package itself, like "python2.6-dev" or "postgresql-8.4". Another problem you may have defining the exact version of the package is that maybe the version 8.4.11-1 of postgresql-8.4 will not be available in the repository in three months or in a year, and you will end up installing the current version in the repo.

示例.您可以使用项目所需的系统包创建一个名为requirements.system"的文件:

Example. You can create a file named "requirements.system" with the system packages you need for you project:

python-virtualenv
python2.6-dev
uuid-dev
python-pip
postgresql-8.4

然后,在您的 INSTALL 文件中说明如何安装系统包.

Then, in your INSTALL file explain how to install the system packages.

# Install system depencences by running
cat ~/project/install/requirements.system | xargs sudo aptitude install

我们已经运行这个配置大约两年了,不得不从头开始重新创建环境几次,我们从来没有遇到过问题.

We have running this configuration for about two years, having to recreate the enviroment from the scrach a few times and we never had a problem.

这篇关于apt-get 的需求文件,类似于 pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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