Python notes: Python version upgrade __python

Source: Internet
Author: User
Tags openssl install perl

Minimize installation and replace Yum Source:
Http://mirrors.163.com/.help/CentOS7-Base-163.repo
Http://mirrors.163.com/.help/CentOS6-Base-163.repo

1. Download Repo file
Yum Install wget
wget Http://mirrors.163.com/.help/CentOS6-Base-163.repo

2. Back up and replace the system's repo files
cd/etc/yum.repos.d/
MV Centos-base.repo Centos-base.repo.bak
MV Centos6-base-163.repo Centos-base.repo

3. Perform Yum source update
Yum Clean All
Yum Makecache
Yum-y Update

4. Installation Development tools:
Yum groupinstall-y ' development tools '
5. Install the Python dependency pack:
Yum install-y zlib-devel bzip2-devel openssl-devel xz-libs

6. Download the new Python version:
Find a new version of the download link to the https://www.python.org/ftp/python/website
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
CA python2.7.9
./configure--prefix=/usr/local
Make all && make Altinstall
Make clean

Make Distclean

Install Python-devel not required for compilation
7. Compile installation complete. Enter the following command to view the version
#/usr/local/bin/python2.7–v
Establish a soft connection to the bin directory of the current system default Python command (installed by default will add/usr/locl/bin to the PATH environment)
#ln-S/usr/local/bin/python2.7/usr/local/bin/python

#/usr/local/bin/python–v
At this point the query displays a version of: 2.7.9. But at this point Yum is not working properly, you need to modify the Yum configuration file.
#vi/usr/bin/yum
Change the #!/usr/bin/python of the head of the file to #!/usr/bin/python2.6///To save the old version before exiting.

8. Install Easy_install Extension
#wget https://pypi.python.org/packages/source/s/setuptools/setuptools-18.0.1.tar.gz
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo/usr/local/bin/python2.7 ez_setup.py
sudo/usr/local/bin/easy_install-2.7 pip


9. Install a new version of Git (version is too low to report 401 errors):
GIT relies on the following packages:
$ yum Install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-extutils-makemaker Package
$ wget Https://codeload.github.com/git/git/zip/master
$ CD Git-master
$ make prefix=/usr/local All
$ sudo make prefix=/usr/local install

9. When git error is installed: Usr/bin/perl makefile.pl prefix= '/usr/local/git ' install_base= '--localedir= '/usr/local/git/share/ Locale
Can ' t locate extutils/makemaker.pm in @INC (@INC contains:/usr/local/lib64/perl5/usr/local/share/perl5/usr/lib64/ Perl5/vendor_perl/usr/share/perl5/vendor_perl/usr/lib64/perl5/usr/share/perl5.) At makefile.pl Line 3.
BEGIN failed--compilation aborted at makefile.pl Line 3.
MAKE[1]: * * * [Perl.mak] Error 2
Make: * * * [Perl/perl.mak] Error 2

Yum Install Perl-extutils-makemaker Package

10. After you upgrade Python and install additional packages, you may receive the following error
Import Pycurl
ImportError:pycurl:libcurl Link-time SSL Backend (NSS) is different from Compile-time SSL backend (OpenSSL)
The solution is:
Pip Uninstall Pycurl
Export PYCURL_SSL_LIBRARY=NSS
Easy_install Pycurl
Note that the previous installation with Pip, and then uninstall, be sure to use Easy_install installation before you can import success


11. Reference;
https://github.com/h2oai/h2o-2/wiki/ Installing-python-2.7-on-centos-6.3.-follow-this-sequence-exactly-for-centos-machine-only


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.