linux/centos6.5 Install python2.7 and Python3.5.2__linux

Source: Internet
Author: User
Tags readline sqlite

installation of python2.7 in centos6.5 environmentUnpack the Python source pack
TAR-XF PYTHON-2.7.6.TAR.XZ

Enter Package Directory
CD Python-2.7.6

Add a configuration item
./configure--prefix=/usr/local/python27

Compile
Make

Error

Python build finished, but the necessary bits to build this modules were not found:
_BSDDB _sqlite3 _ssl
_tkinter bsddb185 bz2
DBM DL GDBM
Imageop Sunaudiodev
To find the necessary bits, look into setup.py in Detect_modules () for the module ' s name.



CentOS installation disk with dependent package installation (ReadLine)
Method:
Mount the centos6.5 CD in the/mnt/cdrom directory
Mkdir/mnt/cdrom
Mount/dev/cdrom/mnt/cdrom
cd/mnt/cdrom/packages/

Tip Missing Readline-devel Package, install Readline-devel package when prompted to rely on Ncurses-devel
RPM-IVH ncurses-devel-5.7-3.20090208.el6.x86_64.rpm

RPM-IVH readline-devel-6.0-4.el6.x86_64.rpm

Delete the related directory reconfiguration and compile
Rm-rf/usr/local/python27
./configure--prefix=/usr/local/python27
Make
Make install
Continue to report missing dependency package directly ignored
② installation ipython1.2.1
TAR-XF ipython-1.2.1.tar.gz

CD ipython-1.2.1

Compiling Ipython with Python27
/usr/local/python27/bin/python2.7 setup.py Build
Compilation successfully performed installation
/usr/local/python27/bin/python2.7 setup.py Install


If the installation succeeds, there is a Ipython file under the/usr/local/python27/bin directory
ls/usr/local/python27/bin/


######################
Link python and Ipython to the bin directory for easy invocation (enter Python and Ipython commands directly)
Ln-sv/usr/local/python27/bin/python2.7/usr/bin/python27


ln-sv/usr/local/python27/bin/ipython/usr/bin/


installation of centos6.5 environment python3.5

To install dependent dependencies:

Yum-y install XZ wget gcc make gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel

Install Python3:

wget HTTP://MIRRORS.SOHU.COM/PYTHON/3.5.2/PYTHON-3.5.2.TAR.XZ

TAR-XF PYTHON-3.5.2.TAR.XZ

CD Python-3.5.2

./configure--enable-shared--enable-loadable-sqlite-extensions--with-zlib

Make && make install

Add Python3 command:

Ln-sv/usr/local/bin/python3.5/usr/bin/python3

Vim/etc/ld.so.conf

/usr/local/lib # New Library file path
Include ld.so.conf.d/*.conf

# Make the Configuration library effective
/sbin/ldconfig

Version detection
# python3-v
Python 3.5.2


Run Python3 directly in the future and you can execute the command via the python3.5.2 version.

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.