Upgrade Python2.4 to 2.6 in SUSE Linux

Source: Internet
Author: User

The original version is 2.4. The python module is reported when scons is installed.

So in SUSE Linux, upgrade to 2.6.

If you want to use the rpm-e command to delete python, You cannot delete it because of software dependency.

So use the source code package for installation and upgrade


Download 2.6.8

Http://www.python.org/download/releases/2.6.8/

Create the installation directory mkdir/usr/local/python2.6

Compile and install./configure -- prefix =/usr/local/python2.6 make & make install

Create a connection

Mv/usr/bin/python/usr/bin/python_bak (Save the original version)

Ln-s/usr/local/python2.6/bin/python/usr/bin

Test Results

Nothing goes smoothly...

Error...

ImportError: No module named readline

 


Google ~ It seems that the readline module is missing

 


2. Install readline

Before installing readline, install setuptools

Cd/usr/src/

Wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e

Tar zxvf setuptools-0.6c11.tar.gz

Cd setuptools-0.6c11/

Python setup. py install


"

Installed/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg

Processing dependencies for setuptools = 0.6c11

Finished processing dependencies for setuptools = 0.6c11

"Indicates that the installation is successful.


Then, install readline-devel and copy the corresponding rpm package from the DVD disc that comes with the SuSe system.

Rpm-ivh readline-devel-5.1-24.13.x86_64.rpm

Rpm-ivh readline-devel-32bit-5.1-24.13.x86_64.rpm

After installing these two dependent packages, you can start to install readline.

Cd/usr/src/

Wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz

Tar zxvf readline-5.2.tar.gz

Cd readline-5.2/

CFLAGS = "-O3-fPIC"./configure

(You must add "-O3-fPIC". Otherwise, the error "libreadline. a: cocould not read symbols: Bad value" will be reported ")

Make CFLAGS =-fPIC

Make CFLAGS =-fPIC install


3. Install the python readline Module

Cd/usr/src/

Wget http://ipython.scipy.org/dist/readline-2.5.1.tar.gz

Tar zxvf readline-2.5.1.tar.gz

Cd/usr/src/readline-2.5.1

Cp/usr/local/lib/{libreadline. a, libhistory. a} readline/

Python setup. py install


"

Installed/usr/local/lib/python2.7/site-packages/readline-2.5.1-py2.7-linux-x86_64.egg

Processing dependencies for readline = 2.5.1

Finished processing dependencies for readline = 2.5.1

"Indicates that the installation is successful.


Then, when you press python, the prompt "ImportError: No module named readline" will not appear.


[Root@10.204.140.127] # python

Python 2.7 (r27: 82500, Sep 12 2012, 19:00:00)

[GCC 4.1.2 20070115 (prerelease) (SUSE Linux)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.