CentOS6.5安装python3.6 pip9.0

特别提示:在安装前,最好不要东系统自带的python2.6的版本,因为系统中有些软件是需要依赖python2.6的。比如yum就需要依赖python2.6

前置依赖包:

[root@root ~]# yum install zlib-devel
[root@root ~]# yum install openssl-devel
[root@root ~]# yum install gcc
[root@root ~]# yum install -y libffi-devel

一、安装python3.6

1、下载python3.6

[root@root ~]# wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz

2、解压

[root@root ~]# tar -xzvf Python-3.6.0.tgz

建个编译目录:

[root@root ~]# mkdir /usr/local/python3

然后编译、安装:

[root@root ~]# cd Python-3.6.0
[root@root ~]# ./configure --prefix=/usr/local/python3
[root@root ~]# make && make install

3、建立软链接:

[root@root ~]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3

4、查看刚才安装python3.6版本:

[root@root ~]# python3 -V

Python 3.6.0

二、安装pip

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

[root@root ~]# wget --no-check-certificate https://files.pythonhosted.org/packages/ef/1d/201c13e353956a1c840f5d0fbf0461bd45bbd678ea4843ebf25924e8984c/setuptools-40.2.0.zip
[root@root ~]# unzip setuptools-40.2.0.zip
[root@root ~]# cd setuptools-40.2.0
[root@root setuptools-40.2.0]# python3 setup.py build
[root@root setuptools-40.2.0]# python3 setup.py install

2、安装pip

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

3、建立软链接

[root@root ~]# ln -s /usr/local/python3/bin/pip /usr/bin/pip

至此python3.6及pip9.0安装完成

二、测试使用pip elasticsearch5

[root@root ~]# pip install elasticsearch5
Collecting elasticsearch5
  Downloading https://files.pythonhosted.org/packages/de/99/9cfd6881a4242a5d03c5c817b0f3231ba3afe5248118e2be465c29c51dce/elasticsearch5-5.5.6-py2.py3-none-any.whl (62kB)
    100% |████████████████████████████████| 71kB 41kB/s
Collecting urllib3>=1.21.1 (from elasticsearch5)
  Downloading https://files.pythonhosted.org/packages/e0/da/55f51ea951e1b7c63a579c09dd7db825bb730ec1fe9c0180fc77bfb31448/urllib3-1.25.6-py2.py3-none-any.whl (125kB)
    100% |████████████████████████████████| 133kB 10kB/s
Installing collected packages: urllib3, elasticsearch5
Successfully installed elasticsearch5-5.5.6 urllib3-1.25.6
You are using pip version 9.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

You are using pip version 9.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

上面这个提示信息是pip的版本为9.0.1的,但提示我们19.3.1的版本是可用的,我们可以通过 pip install --upgrade pip 来升级

[root@root ~]# pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 967kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.3.1

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值