Centos7 install pip

1. Execute: yum install python-pip

If there is no package python-pip, execute: yum -y install epel-release, then execute yum install python-pip

2.pip install --upgrade pip

centos installed by default python2.7

1.mkdir /usr/local/python3

3. Installation dependencies:

yum -y groupinstall "Development tools"

When installed may not be installed on, or what other problems can be solved by replacing the source
Linux (CentOS7.1) to modify the default source for domestic yum yum source cloud Ali
download wget
yum -y install wget
echo back up your current yum source
mv /etc/yum.repos.d.backup4comex /etc/yum.repos.d
echo the new empty set yum source directory
mkdir /etc/yum.repos.d
echo download Ali cloud yum source configuration
wget -O / etc / yum .repos.d / CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
then rebuild cache:
yum Clean All
yum makecache

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

4. In the / usr / local / python3 directory

wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
tar -xvf  Python-3.6.2.tar.xz
cd Python-3.6.2
./configure --prefix=/usr/local/python3
make && make install

5. Switch to the / usr / bin / directory

mv python python.bak
mv pip pip.bak
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip

6. yum prevent future use when installing software error sources, the following two modifications

of the first row change / usr / bin / yum of

#!/usr/bin/python改成#!/usr/bin/python2.7

Modify / usr / libexec / first row urlgrabber-ext-down of

#!/usr/bin/python改成#!/usr/bin/python2.7

7. Verify

输入python,进入python3.6.2

输入python2,进入python2.7

8, there's a problem when using pip install modules often error

[root@localhost Python-3.6.2]# pip install ipython==1.2.1
Collecting ipython==1.2.1
Could not fetch URL https://pypi.python.org/simple/ipython/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748) - skipping
Could not find a version that satisfies the requirement ipython==1.2.1 (from versions: )
No matching distribution found for ipython==1.2.1

This is because the ssl certificate is not certified for use in domestic mirror

pip install ipython==1.2.1 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

Ipython which is the name of the package, this can be solved.