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

查看:127
本文介绍了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可能会在三个月或一年内在存储库中不可用,并且您最终将在回购中安装当前版本.

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天全站免登陆