CentOS installation python and extension

Source: Internet
Author: User

Install the Python environment on a new server. Installed before many times, but have not summed up, today need to reinstall, found or listen to a lot of, so decided to summarize, I hope the next time in the re-installation can be quickly done.

The first is to download python2.7, on the server, just use wget bar.

Download with this link, https://www.python.org/downloads/release/python-279/we need to be 2.7 version, so chose this. Select the source code in the tgz format to do so.

wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz

TAR-ZXVF your.tgz

CD Python-dir

./configure

Make

sudo make install

Problems may occur, depending on the prompt that appears, install the corresponding package is available.

After that, python2.7 should be installed under/usr/local/bin/python2.7. The problem now is that the original python of the system is 2.6, and the environment should be 2.6. However, this does not matter, when used, with the corresponding suffix can be.


Installing the Redis Extension

Https://pypi.python.org/packages/source/r/redis/redis-2.10.3.tar.gz

sudo python2.7 setup.py Install


Installing Pymongo

Download

Https://codeload.github.com/mongodb/mongo-python-driver/zip/master

sudo python2.7 setup.py Install


Installing Mysql-python

Download

wget https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip#md5= 654f75b302db6ed8dc5a898c625e030c--no-check-certificate

Installation

Unzip Your.zip unzip the zip package.

python2.7 setup.py Build Compilation

sudo python2.7 setup.py Install


Test extensions

Import MySQLdb

Import Redis

Import Pymongo

If the module not found is not reported, it is proved to be available. If you need a different version, you can find the corresponding package, and the installation process is similar. There is time to specialize in the use of Easy_install installation method, today tried, but failed, the next special write again.

CentOS installation python and extension

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.