CentOS 6.6 安装pip

前一篇讲了如何在linux中安装python 2.7.8,接下来继续安装pip,pip是python安装各种包的工具,是非常腻害的工具得意

在安装过程中,经常报 :Nothing to do,有很多原因,其中一个原因是虚拟机竟然没有连网偷笑,简直是太扯了,对自己太无语了。。。

1、先安装扩展源EPEL

显然,os中的源已经是安装了,而且是最新版本:

[root@wc1 ~]# yum install epel-release -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * epel: mirror01.idc.hinet.net
 * extras: ftp.sjtu.edu.cn
 * updates: centos.ustc.edu.cn
Package epel-release-6-8.noarch already installed and latest version
Nothing to do

2、安装pip

一开始我以为安装pip就是命令:yum -y install pip,但是报错说:找不到数据源。。。

后来搜了一下,才知道要安装的是 python-pip:

[root@wc1 ~]# yum -y install python-pip
Loaded plugins: fastestmirror, refresh-packagekit, security
  
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6) <epel@fedoraproject.org>
 Package: epel-release-6-8.noarch (@extras)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : python-setuptools-0.6.10-3.el6.noarch                        1/2 
  Installing : python-pip-7.1.0-1.el6.noarch                                2/2 
  Verifying  : python-pip-7.1.0-1.el6.noarch                                1/2 
  Verifying  : python-setuptools-0.6.10-3.el6.noarch                        2/2 

Installed:
  python-pip.noarch 0:7.1.0-1.el6                                               

Dependency Installed:
  python-setuptools.noarch 0:0.6.10-3.el6                                       

Complete!

安装完后,验证pip版本,发现安装的是pip2.6

[root@wc1 Desktop]# whereis pip
pip: /usr/bin/pip /usr/bin/pip2.6


3、安装python对应版本的pip

[root@wc1 Desktop]# wget https://bootstrap.pypa.io/ez_setup.py

[root@wc1 Desktop]# python ez_setup.py

[root@wc1 Desktop]# /usr/local/python/bin/easy_install-2.7 pip
Searching for pip
......

[root@wc1 Desktop]# mv /usr/bin/pip /usr/bin/pip2.6.6
[root@wc1 Desktop]# ln -s /usr/local/python/bin/pip2.7 /usr/bin/pip

验证版本:

[root@wc1 Desktop]# pip --version
pip 9.0.1 from /usr/local/python/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)

4、验证是否可以下载包

这里下载虚环境:virtualenv

[root@wc1 Desktop]# pip install virtualenv
Collecting virtualenv
/usr/local/python/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/python/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached virtualenv-15.1.0-py2.py3-none-any.whl
Installing collected packages: virtualenv
Successfully installed virtualenv-15.1.0

5、解决pip的SNIMissingWarning警告

[root@wc1 Desktop]# pip install pyopenssl ndg-httpsclient pyasn1


6、升级pip

[root@wc1 Desktop]# pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/python/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值