Centos6.5 installation python2.7.12,pip9.0.1 and precautions

Source: Internet
Author: User
Tags curl openssl


One: python2.7.12 installation


1: Get python2.7.12


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


2: Ensure installation l python-devel libffi-devel OpenSSL openssl-deve l If not, use Yum to install

GCC zlib zlib-devel python-devel libffi-devel OpenSSL openssl-devel


GCC is used for compile time and error if do not install make

Zlib for the installation of Setuptools, otherwise there will be the following error :

Runtimeerror:compression requires the (missing) zlib module

OpenSSL if not installed, use PIP to install the module will be error, show SSL module is not available and so on ...



3: tar xvf python-2.7.12.tgz


4: CD Python-2.7.12


5: sudo./configure--prefix=/usr/local/python2.7--with-zlib=/usr/local/include


6: Make && make install


7: cd/usr/local/python2.7/include/python2.7/


8: Copy the header file to the standard directory, prevent installation similar to ansible find the head file


sudo cp-a./*/usr/loca/bin/include/


9: cd/usr/bin/


10: Rename old version


sudo mv Python python2.6


11: Modify the Python location of the Yum command to prevent Yum from being unusable


sudo sed-i ' [email protected]#!/usr/bin/[email protected]#!/usr/bin/[email protected] '/usr/bin/yum


12: Setting up a soft connection for a new Python installation


sudo ln-s/usr/local/python2.7/bin/python/usr/bin/python


13: See if the installation was successful

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/8A/5D/wKiom1gukVbx59-gAAALwk70cKM330.png "title=" QQ picture 20161118132731.png "width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:700PX;HEIGHT:36PX; "alt = "Wkiom1gukvbx59-gaaalwk70ckm330.png"/>


=======================================================================================


Two: Pip installation


1: Get pip9.0.1


wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/ PIP-9.0.1.TAR.GZ#MD5=35F01DA33009719497F01A4BA69D63C9--no-check-certificate


2: Unzip

Tar xvf pip-9.0.1.tar.gz


3: Setting Environment variables


~/.bash_profile Add the following content


python_home=/usr/local/python2.7

Path= $PATH: $HOME/bin: $PYTHON _home/bin


SOURCE ~/.bash_profile


4: Make a soft connection to prevent sudo pip command not found appear


which Pip #先用which Look at the path to the PIP

sudo ln-s/usr/local/python2.7/bin/pip/usr/bin/pip


5: Installation


sudo python setup.py install


6: Select domestic PIP source installation software


Create files and folders in the user's home directory ~/.pip/pip.conf

Add the following content:

[Global]

Index-url = Http://pypi.douban.com/simple


7: The module can be installed


Pip Install Pyyaml--trusted-host pypi.douban.com



=======================================================================================



Three: Pip SSL error after installing a new version


Sslerror:can ' t connect to HTTPS URL because the SSL module was not available


------------------------------------------------------------------------------

Note: This method excerpt from the network, but did not solve my problem, so reset the virtual machine, from the first step

When installing, make sure all dependencies are installed and there will be no problems.

-------------------------------------------------------------------------------


Problem reason: Curl's certificate is too old to download the latest certificate:
Download the latest certificate file

wget HTTP://CURL.HAXX.SE/CA/CACERT.PEM

Rename to Ca-bundle.crt drop to default directory

MV Cacert.pem CA-BUNDLE.CRT
MV ca-bundle.crt/etc/pki/tls/certs/


Reference:

http://sofar.blog.51cto.com/353572/1579894/

Http://blog.chinaunix.net/uid-26000296-id-4769414.html

http://topmanopensource.iteye.com/blog/2004853//domestic PIP source


This article is from the "Breeze" blog, be sure to keep this source http://358778493.blog.51cto.com/11386071/1874222

Centos6.5 installation python2.7.12,pip9.0.1 and precautions

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.