Linux Ubuntu 12.04 LTS:在不破坏依赖关系的情况下将 python 2.7.3 更新到 2.7.6
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20445565/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ubuntu 12.04 LTS: Update python 2.7.3 to 2.7.6 without breaking dependencies
提问by eenblam
So, I recently reinstalled Precise after encountering some swap issues. A friend and I were discussing working on something in Python together, so I checked my version. However, 12.04 comes with Python 2.7.3 installed. I wanted to update to 2.7.6, so I downloaded the tar for it. Then, I was silly enough to punch in sudo apt-get remove python
without considering the dependency issues for my desktop. (My rationale was that I wanted to get rid of the old install.)
所以,我最近在遇到一些交换问题后重新安装了 Precise。我和一个朋友正在讨论一起用 Python 做一些事情,所以我检查了我的版本。但是,12.04 安装了 Python 2.7.3。我想更新到 2.7.6,所以我为它下载了 tar。然后,我很傻,sudo apt-get remove python
没有考虑桌面的依赖问题就打进去了。(我的理由是我想摆脱旧的安装。)
Long story short, I broke all of my Python dependencies, thus destroying Unity. I just finished re-installing Ubuntu again.
长话短说,我破坏了所有 Python 依赖项,从而破坏了 Unity。我刚刚完成重新安装 Ubuntu。
I tried following this tutorial, but
我尝试按照本教程进行操作,但是
make test
had about a 50% failure rate (a separate concern in itself)When I entered
make install && chmod -v 755 /usr/lib/libpython2.7.so.1.0
make test
有大约 50% 的失败率(本身就是一个单独的问题)当我进入
make install && chmod -v 755 /usr/lib/libpython2.7.so.1.0
I got
我有
/usr/bin/install -c python /usr/bin/python2.7
/usr/bin/install: cannot remove `/usr/bin/python2.7': Permission denied
make: *** [altbininstall] Error 1
I'm concerned, as a result, that running the command again as root would result in removing 2.7.3 all over again. I'm anything but a bash guru, so I don't have a good sense for what's going under the hood here. I'm just trying to get 2.7.6 at this point; I'm perfectly content with 2.7.3 staying on the machine if there are dependencies.
因此,我担心以 root 身份再次运行该命令会导致再次删除 2.7.3。我不是一个 bash 大师,所以我对这里的幕后情况没有很好的了解。我现在只是想得到 2.7.6;如果存在依赖关系,我非常满意 2.7.3 留在机器上。
So, should I...
那么,我该不该...
A. just run the command as root?
A. 只以 root 身份运行命令?
B. update Python some other way (and by "update" I really just mean get a clean install of 2.7.6)? If so, how?
B. 以其他方式更新 Python(我所说的“更新”实际上只是指获得 2.7.6 的全新安装)?如果是这样,如何?
采纳答案by Dirk Eddelbuettel
It's a "have your cake and eat it" problem:
这是一个“吃你的蛋糕”的问题:
- Eitheryou value the stability of Ubuntu 12.04 LTS,
- oryou value current versions.
- 要么你看重 Ubuntu 12.04 LTS 的稳定性,
- 或者您重视当前版本。
I tend to upgrade every six months. There can be hybrids; maybe there is a PPA with "backported" newer Python your 12.04 version.
我倾向于每六个月升级一次。可以有杂种;也许你的 12.04 版本有一个带有“反向移植”较新 Python 的 PPA。
回答by Guy Gavriely
removing python from Ubuntu even temporarily will probably irreversibly crash your system.
即使是暂时从 Ubuntu 中删除 python 也可能会不可逆转地使您的系统崩溃。
for handling multiple versions of python and its libraries, check out python virtualenvor even better virtualenvwrapper
要处理多个版本的 python 及其库,请查看python virtualenv甚至更好的virtualenvwrapper
see a nice article here
在这里看到一篇不错的文章