CentOS6.5 64-bit system installs 32-bit Python

Source: Internet
Author: User

CentOS6.5 comes with gcc 4.4.7 and Python 2.6.6

Reminder: I am using root user, if not root user, just add sudo in front of the instruction

First, make sure GCC compiles the code to 32-bit, and installs the 32-bit compilation environment using Yum

#yum Install libstdc++-devel.i686 glibc.i686 libgcc.i686 libstdc++.i686 glibc-devel.i686

# yum-y Install Glibc-devel

# yum-y Install glibc-devel.i686

# yum Install libstdc++-devel.i686

After the installation of the environment, a simple test can compile 32-bit programs such as #gcc-m32 TEST.c, the compilation is complete without problems

After the 32-bit compilation environment is built, compile and install using python2.7.7 source code

You need to install the following environment before compiling the source code

#yum Install libgcc.i686 glibc-devel.i686 glibc.i686 zlib-devel.i686
#yum Install readline-devel.i686 gdbm-devel.i686 openssl-devel.i686 ncurses-devel.i686
#yum Install tcl-devel.i686 db4-devel.i686 bzip2-devel.i686

The preparation has been completed by the source code to install 32-bit Python, the source I put in the/USR/LOCAL/SRC

#cd/USR/LOCAL/SRC

#wget http://www.python.org/ftp/python/2.7.7/Python-2.7.7.tgz
#tar XZVF python-2.7.7.tgz
#cd python-2.7.7/
#mkdir-P/usr/local/python-2.7
#CFLAGS =-m32 ldflags=-m32./configure--prefix=/usr/local/python2.7--enable-shared Ld_run_path=/usr/local/lib
#make
#make Install

After the compilation installation is complete, you can use

#file/usr/local/python2.7/bin/python2.7

Displayed as

/usr/local/python2.7/bin/python2.7:elf 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (Uses Sha Red Libs), for Gnu/linux 2.6.18, not stripped

Description python2.7 32-bit has been successfully installed

Then set up the software connection and configuration environment, in no particular order

Setting up a soft connection

#mv/usr/bin/python/usr/bin/python_old
#ln-S/usr/local/python27/bin/python/usr/bin/python

Yum relies on python2.6.6, and Yum cannot use it with the above settings

#vi/usr/bin/yum

Change the first line/usr/bin/python to/usr/bin/python_old and save the exit so Yum can use it properly.

Configuring the Environment

# echo $PATH
/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
# path= "$PATH":/usr/local/python2.7/bin
# echo $PATH
/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin:/usr/local/python2.7/bin

Run #python If error occurs while loading shared Libraries:libpython2.7.so.1.0:cannot open Shared object file:no such file or D Irectory Error

#vi/etc/ld.so.conf

Add python2.7 Lib Library, my is/usr/local/python2.7/lib, that is, the path of Lib in the installation directory, save exit

#ldconfig-V

By this python2.7 32-bit installation is complete.

CentOS6.5 64-bit system installs 32-bit Python

Related Article

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.