简体   繁体   English

apt-get安装较旧版本的软件包(Ubuntu)

[英]apt-get installing older version of packages (Ubuntu)

I'm trying to install pip and virtualenv on a server (running Ubuntu 12.04.4 LTS) on which I have access, but I can only do it with sudo apt-get install (school politics). 我正在尝试在具有访问权限的服务器(运行Ubuntu 12.04.4 LTS)上安装pipvirtualenv ,但是我只能使用sudo apt-get install (学校政策) sudo apt-get install The problem is that althought I have run the sudo apt-get update command to update the packages list, I think it keeps installing old ones. 问题是,尽管我已经运行sudo apt-get update命令来更新软件包列表,但我认为它一直在安装旧软件包。 After doing sudo apt-get install python-pip python-virtualenv , I do pip --version on which I get the 1.0 , and virtualenv --version on which I get 1.7.1.2 . 在执行sudo apt-get install python-pip python-virtualenv ,我执行pip --version获得1.0 ,以及virtualenv --version获得1.7.1.2 These two version are quite old ( pip is already in 1.5.5 and virtualenv in 1.11.5 ). 这两个版本相当老( pip1.5.5已经存在, virtualenv1.11.5已经1.11.5 )。 I read that the problem is that the packages list is not up-to-date, but the command sudo apt-get update should solve this, but I guess no. 我读到的问题是软件包列表不是最新的,但是命令sudo apt-get update应该可以解决此问题,但我想没有。 How can I solve this? 我该如何解决? Thanks a lot! 非常感谢!

apt-get update updates packages from Ubuntu package catalog, which has nothing to do with mainstream versions. apt-get update从Ubuntu软件包目录中更新软件包,与主流版本无关。

LTS in Ubuntu stands for Long Term Support. Ubuntu中的LTS表示长期支持。 Which means that after a certain period in time they will only release security-related bugfixes to the packages. 这意味着在一段时间后,他们将只向软件包发布与安全相关的错误修正。 In general, major version of packages will not change inside of a major Ubuntu release, to make sure backwards-compatibility is kept. 通常,软件包的主要版本在Ubuntu的主要发行版本中不会更改,以确保保持向后兼容。

So if then only thing you can do is apt-get update , you have 2 options: 因此,如果您只能做apt-get update ,那么您有2个选择:

  • find a PPA that provides fresher versions of packages that you need, add it and repeat the update/install exercise 查找提供您所需软件包较新版本的PPA,将其添加并重复更新/安装练习
  • find those packages elsewhere, download them in .deb format and install. 在其他地方找到这些软件包,以.deb格式下载并安装。

If you really need to use the latest stable versions of Python packages, then do not use apt-get for installing Python packages and use pip instead. 如果您确实需要使用Python软件包的最新稳定版本,请不要使用apt-get来安装Python软件包,而应使用pip。 If you would use apt-get and later install the same packages by means of pip or (better not) easy_install or setup.py , you are likely to run into version conflicts wondering, why your python based commands are of unexpected versions, or even worse, why they do not work at all. 如果要使用apt-get并稍后通过pip或(最好不要使用) easy_installsetup.py安装相同的软件包,您可能会遇到版本冲突,想知道为什么您的基于python的命令具有意外版本,甚至更糟糕的是,为什么它们根本不起作用。

I try to follow this pattern: 我尝试遵循以下模式:

1. system wide pip installation first 1.首先安装系统级的点子

Using instructions from here: http://pip.readthedocs.org/en/latest/installing.html find get-pip.py script, download it and run as python script. 使用此处的说明: http : get-pip.py查找get-pip.py脚本,下载该脚本并以python脚本运行。

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py
$ rm get-pip.py

2. use pip to install virtualenv system wide 2.使用pip在全系统范围内安装virtualenv

this shall be as easy as: 这应该很简单:

$ sudo pip install virtualenv

3. (optional) install virtualenvwrapper - system wide or to user profile 3.(可选)安装virtualenvwrapper-系统范围或用户配置文件

$ sudo pip install virtualenvwrapper

and follow instructions for configuring it. 并按照说明进行配置。

4. Since now, install inside your virtualenv environments 4.从现在开始,在您的virtualenv环境中安装

This shall prevent conflicts between various versions of packages. 这将防止不同版本的软件包之间发生冲突。

You are free to update particular virtualenvs as you need one by one independently. 您可以自由地独立更新一个特定的虚拟环境。

5. (optional) Configure installation cache directories for installation speed 5.(可选)配置安装缓存目录以提高安装速度

There are method how to speed up repeated installation of packages, what comes handy if you get used using virtualenv often. 有一些方法可以加快重复安装软件包的速度,如果您经常使用virtualenv会很方便。 For details see my answer: https://stackoverflow.com/a/18520729/346478 有关详细信息,请参阅我的答案: https : //stackoverflow.com/a/18520729/346478

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM