Python2.7 Source compiles and integrates third-party Python modules

Source: Internet
Author: User

due to the low Python version of REDHAT5, many new third-party python packages and new features are not available, so you need to upgrade your system to include Python versions, plan to upgrade to python2.7.4, and integrate with some of the most common third-party modules in your business.

python installation

1 Source Download

Download python-2.7.4.tgz on official website

2 source installation, installation directory/opt/programs/python_2.7.4

Tar zxvf python-2.7.4.tgzcd python-2.7.4./configure--prefix=/opt/programs/python_2.7.4makemake installln-s/opt/ programs/python_2.7.4/bin/python2.7  /usr/bin/python2.7

This python2.7 has been installed under the /opt/programs/python_2.7.4 directory .

3 Installing Mysql-python third-party modules

Wget ' http://nchc.dl.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/MySQL-python-1.2.4b4.tar.gz ' Tar zxvf mysql-python-1.2.4b4.tar.gzcd mysql-python-1.2.4b4python2.7 setup.py Build
to the fourth step, the error is as follows


The reason is that when the source code compiled python2.7, do not open the SSL option, modify the python2.7 source directory python-2.7.4/modules/setup.dist files, and then re-source compilation python2.7

#取消下面四行的注视SSL =/usr/local/ssl_ssl _ssl.c         -duse_ssl-i$ (SSL)/include-i$ (SSL)/include/openssl-l$         (SSL)/lib- Lssl-lcrypto

recompile python2.7, refer to the 2nd step

The Mysql-devel package needs to be installed on the compiled host

Yum Install Mysql-devel

Compile and install the Mysql-python module to the/opt/programs/python2.7.4 directory again, as it is to be integrated in the python2.7

CD mysql-python-1.2.4b4python2.7 setup.py buildpython2.7 setup.py Install--prefix=/opt/programs/python_2.7.4/
Validation


4 Installing cx-oracle third-party modules

Wget ' https://pypi.python.org/packages/source/c/cx_Oracle/cx_Oracle-5.1.3.tar.gz#md5= Cd6ff16559cbc9c20087ec812c7092ab ' tar zxvf cx_oracle-5.1.3.tar.gzcd cx_oracle-5.1.3python2.7 setup.py Build

to the fourth step, the error is as follows


Unable to find the local Oracle, check the relevant information, only know that when compiling cx_oracle, the Oracle client lib library will be searched locally, if not found in the error, it can only install the Oracle client, Fortunately, the Oracle website has rpm package, download and install directly


After installing the Oracle client, set the ORACLE_HOME environment variable in the current environment, or you will still report the error of software not found above

Export oracle_home=/usr/lib/oracle/11.2/client64/

Compile and install the cx-oracle module to the/opt/programs/python2.7.4 directory again, as it is to be integrated in the python2.7

CD cx_oracle-5.1.3python2.7 setup.py buildpython2.7 setup.py Install--prefix=/opt/programs/python_2.7.4/

Look, It's not a problem, just check it out.


This god horse situation, check some, found not set ld_library_path

Export ld_library_path=/usr/lib/oracle/11.2/client64/lib/


5 the/opt/programs/ The python2.7 directory is made into RPM packages, which can then be installed on other machines, but because of the addition of MySQL and Oracle's third-party libraries, the dev kits for these databases are also required for other machines to install the python2.7 RPM package.




Python2.7 Source compiles and integrates third-party Python modules

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.