天天看点

Python升级(2.4升级到2.7.3)

一、下载安装包,然后进行升级部署

<code>[root@a2 tmp]</code><code># tar zxvf Python-2.7.3.tgz </code>

<code>[root@a2 Python-2.7.3]</code><code># ./configure &amp;&amp; make &amp;&amp; make install </code>

<code>[root@a2 Python-2.7.3]</code><code># which python</code>

<code>/usr/local/bin/python</code>

<code>[root@a2 Python-2.7.3]</code><code># ln -sf /usr/local/bin/python /usr/bin/python</code>

<code>[root@a2 Python-2.7.3]</code><code># python -V</code>

<code>Python 2.7.3</code>

二、处理升级后,yum的情况

由于Python升级后,看下原有yum是否还能正常使用

<code>[root@a2 Python-2.7.3]</code><code># yum clean all</code>

<code>There was a problem importing one of the Python modules</code>

<code>required to run yum. The error leading to this problem was:</code>

<code>   </code><code>No module named yum</code>

<code>Please </code><code>install</code> <code>a package </code><code>which</code> <code>provides this module, or</code>

<code>verify that the module is installed correctly.</code>

<code>It</code><code>'s possible that the above module doesn'</code><code>t match the</code>

<code>current version of Python, </code><code>which</code> <code>is:</code>

<code>2.7.3 (default, Dec 17 2013, 17:33:06) </code>

<code>[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)]</code>

<code>If you cannot solve this problem yourself, please go to </code>

<code>the yum faq at:</code>

<code>  </code><code>http:</code><code>//wiki</code><code>.linux.duke.edu</code><code>/YumFaq</code>

三、修改yum配置文件

<code>[root@a2 Python-2.7.3]</code><code># vim /usr/bin/yum </code>

<code>将“</code><code>#!/usr/bin/python”改为“#!/usr/bin/python2.4”</code>

<code>Loaded plugins: product-</code><code>id</code><code>, security, subscription-manager</code>

<code>This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.</code>

<code>Cleaning up Everything</code>

本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1703119,如需转载请自行联系原作者