Centos python installation and extension, centospython

Source: Internet
Author: User

Centos python installation and extension, centospython

Install the python environment on a new server. I have installed it many times before, but I have not summarized it. I need to reinstall it today, but I still have to worry about it. So I decided to summarize it. I hope the next time I reinstall it, I hope it can be done quickly.

First, download python2.7 and use wget on the server.

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

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. Install the corresponding package as prompted.

After that, python2.7 should be installed under/usr/local/bin/python2.7. The problem is that the system's original python version is 2.6, and the environment should also be 2.6. However, this does not matter. You can use the corresponding suffix when using it.


Install redis Extension

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

Sudo python2.7 setup. py install


Install pymongo

Download

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

Sudo python2.7 setup. py install


Install mysql-python

Download

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

Install

Unzip your.zip unzip the zip package.

Python2.7 setup. py build Compilation

Install sudo python2.7 setup. py install


Test Extension

Import MySQLdb

Import redis

Import pymongo

If module not found is not reported, it turns out that it can be used. If you need another version, you can find the corresponding package. The installation process is similar. I have time to study how to install it with easy_install. I tried it today but failed. I will try again next time.

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.