CentOS6.5安装pip

Posted hunttown

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6.5安装pip相关的知识,希望对你有一定的参考价值。

首先重要的事情说三遍,因为可能有程序依赖目前的python2环境,比如yum:

  不要动现有的python2环境!

  不要动现有的python2环境!

  不要动现有的python2环境!

如果你动了,yum报错了,请参考:https://www.cnblogs.com/hunttown/p/9625662.html

 

前置依赖包:

[[email protected] ~]# yum install zlib-devel
[[email protected] ~]# yum install openssl-devel

 

一、安装python3.6

1、下载python3

[[email protected] ~]# wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

2、解压

[[email protected] ~]# tar -xzvf Python-3.7.0.tgz

先建一个编译目录:

[[email protected] ~]# mkdir /usr/local/python3

Python3.7版本需要一个新的包libffi-devel,安装此包之后再次进行编译安装即可。

[[email protected] ~]# yum install -y libffi-devel

然后编译、安装:

[[email protected] ~]# cd Python-3.7.0
[[email protected] ~]# ./configure --prefix=/usr/local/python3
[[email protected] ~]# make
[[email protected] ~]# make install

3、建立软链接:

[[email protected] ~]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3

4、查看版本:

[[email protected] ~]# python3 -V

Python 3.7.0

 

二、安装pip

1、安装pip前需要前置安装setuptools

[[email protected] ~]# wget https://pypi.python.org/packages/source/s/setuptools/setuptools-28.8.tar.gz
[[email protected] ~]# tar -zxvf setuptools-28.8.tar.gz
[[email protected] ~]# cd setuptools-28.8
[[email protected] setuptools-28.8]# python3 setup.py build
[[email protected] setuptools-28.8]# python3 setup.py install

 

2、安装pip

[[email protected] ~]# wget https://pypi.python.org/packages/source/p/pip/pip-9.0.1.tar.gz
[[email protected] ~]# tar -zxvf pip-9.0.1.tar.gz
[[email protected] ~]# cd pip-9.0.1
[[email protected] pip-9.0.1]# python3 setup.py build
[[email protected] pip-9.0.1]# python3 setup.py install

pip安装完成。

 

以上是关于CentOS6.5安装pip的主要内容,如果未能解决你的问题,请参考以下文章

CentOS6.5安装pip

Centos6.5 python2.6.6升级2.7.13,安装setuptools和pip

Linux CentOS6.5安装Python2.7以及pip等工具

centos6.5升级python2.6到2.7 + 安装pip

Centos6.5安装python2.7.12,pip9.0.1及其注意事项

centos6.5升级python3并配置pip