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.