天天看點

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,如需轉載請自行聯系原作者