简体   繁体   English

Fedora Python升级失败了easy_install

[英]Fedora Python Upgrade broke easy_install

Fedora Core 9 includes Python 2.5.1. Fedora Core 9包含Python 2.5.1。 I can use YUM to get latest and greatest releases. 我可以使用YUM来获取最新和最好的版本。

To get ready for 2.6 official testing, I wanted to start with 2.5.4. 为了准备2.6正式测试,我想从2.5.4开始。 It appears that there's no Fedora 9 YUM package, because 2.5.4 isn't an official part of FC9. 似乎没有Fedora 9 YUM软件包,因为2.5.4并不是FC9的正式组成部分。

I downloaded 2.5.4, did ./configure; make; make install 我下载了2.5.4,做了./configure; make; make install ./configure; make; make install ./configure; make; make install and wound up with two Pythons. ./configure; make; make install并用两个Python结束。 The official 2.5.1 (in /usr/bin ) and the new 2.5.4. 官方2.5.1(在/usr/bin )和新的2.5.4。 (in /usr/local/bin ). (在/usr/local/bin )。

None of my technology stack is installed in /usr/local/lib/python2.5 . 我的技术堆栈都没有安装在/usr/local/lib/python2.5

It appears that I have several choices for going forward. 看来我有几种选择可以前进。 Anyone have any preferences? 有人有什么喜好吗?

  • Copy /usr/lib/python2.5/* to /usr/local/lib/python2.5 to replicate my environment. 将/usr/lib/python2.5/*复制到/usr/local/lib/python2.5以复制我的环境。 This should work, unless some part of the Python libraries have /usr/bin/python wired in during installation. 除非安装过程中连接了某些Python库的/ usr / bin / python,否则这应该可行。 This is sure simple, but is there a down side? 这肯定很简单,但是有缺点吗?

  • Reinstall everything by running easy_install . 通过运行easy_install重新安装所有内容。 Except, easy_install is (currently) hard-wired to /usr/bin/python . 除外, easy_install (当前)被硬连接到/usr/bin/python So, I'd have to fix easy_install first, then reinstall everything. 因此,我必须先修复easy_install ,然后再重新安装所有内容。

    This takes some time, but it gives me a clean, new latest-and-greatest environment. 这需要一些时间,但是它为我提供了一个全新的,最新的,干净的环境。 But is there a down-side? 但是有缺点吗? [And why does easy_install hard-wire itself?] [为什么easy_install本身会硬接线?]

  • Relink /usr/bin/python to be /usr/local/bin/python . /usr/bin/python重新链接为/usr/local/bin/python I'd still have to copy or reinstall the library, so I don't think this does me any good. 我仍然必须复制或重新安装该库,所以我认为这对我没有任何好处。 [It would make easy_install work; [它将使easy_install起作用; but so would editing /usr/bin/easy_install .] 但是编辑/usr/bin/easy_install 。]

Has anyone copied their library? 有没有人复制他们的图书馆? Is it that simple? 这么简单吗?

Or should I fix easy_install and simply step through the installation guide and build a new, clean, latest-and-greatest? 还是我应该修复easy_install并简单地逐步阅读安装指南并构建一个新的,干净的,最新的和最新的?


Edit 编辑

Or, should I 或者,我应该

  • Skip trying to resolve the 2.5.1 and 2.5.4 issues and just jump straight to 2.6? 跳过尝试解决2.5.1和2.5.4问题,而直接跳到2.6吗?

Normally, you would only have one version of a python release installed. 通常,您只会安装一个版本的python版本。 Since 2.5.1 and 2.5.4 are from the same release, copying your libraries should work fine. 由于2.5.1和2.5.4来自同一版本,因此复制库应该可以正常工作。 What you would need to watch out for, is that you now have /usr/bin/python, and /usr/local/bin/python in your path, and some utilities may get confused. 您需要注意的是,您现在的路径中有/ usr / bin / python和/ usr / local / bin / python,有些实用程序可能会感到困惑。

If you need to have both micro-releases installed at once, I would keep 2.5.4 out of your path altogether, or allow it to completely clobber the other (do so at your own risk though ;) If you go with the former, you can also point 2.5.4 to your site-packages by using the PYTHONPATH environment variable. 如果您需要一次安装两个微型发行版,那么我将把2.5.4完全排除在外,或者让它完全破坏另一个版本(不过,这需要您自担风险;)如果选择前者,您还可以使用PYTHONPATH环境变量将2.5.4指向您的站点包。

Ubuntu takes a different route, and this is how you can handle different major releases. Ubuntu采取了不同的途径,这就是您处理不同主要版本的方式。 The python binary is given with the version appended: python二进制文件带有附加的版本:

/usr/bin/python -> python2.6
/usr/bin/python2.5
/usr/bin/python2.6

Each has their own /usr/lib/python2.X directory with versions of all the modules. 每个模块都有自己的/usr/lib/python2.X目录,其中包含所有模块的版本。

And lastly, you can further customize your setup by modifying your site.py 最后,您可以通过修改site.py进一步自定义设置

我建议您创建一个virtualenv(或多个)以将软件包安装到其中。

I've had similar experiences and issues when installing Python 2.5 on an older release of ubuntu that supplied 2.4 out of the box. 在提供2.4的较早版本的ubuntu上安装Python 2.5时,我也遇到过类似的问题。

I first tried to patch easy_install , but this led to problems with anything that wanted to use the os-supplied version of python. 我首先尝试修补easy_install ,但是这导致了任何想要使用操作系统提供的python版本的问题。 I was often fiddling with the tool chain to fix different errors that might crop up with every install. 我经常摆弄工具链来修复每次安装时可能出现的各种错误。 Installing any python software via apt, or installing any software from apt that had a python easy_install script as part of the install, was often amusing. 通过apt安装任何python软件,或者从apt安装任何包含python easy_install脚本作为安装一部分的软件,通常都很有趣。 I'm sure I could probably have been more vigilant in patching easy_install , but I gave up. 我敢肯定,在修补easy_install可能会更加警惕,但我放弃了。

Instead, I copied the library, and everything worked. 相反,我复制了库,一切正常。 As you say, there may be issues depending on what you have installed, but I didn't run into issues. 正如您所说,根据您所安装的内容,可能会出现问题,但是我没有遇到任何问题。 Double-checking Python's site.py module, I did see that it operates entirely on relative paths, building absolute paths dynamically; site.py检查Python的site.py模块,我确实看到它完全在相对路径上运行,动态地建立绝对路径。 this gave me some confidence to try the "copy everything" approach. 这使我有信心尝试“复制所有内容”方法。 I double-checked any .pth files, then went for it. 我仔细检查了所有.pth文件,然后进行检查。

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

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