python2.6中pip安装失败怎么办-创新互联

创新互联www.cdcxhl.cn八线动态BGP香港云服务器提供商,新人活动买多久送多久,划算不套路!

10多年专注建站、设计、互联网产品按需求定制开发服务,业务涵盖品牌网站制作商城网站定制开发、微信小程序定制开发、软件系统开发、重庆APP开发等。凭借多年丰富的经验,我们会仔细了解每个客户的需求而做出多方面的分析、设计、整合,为客户设计出具风格及创意性的商业解决方案,成都创新互联公司更提供一系列网站制作和网站推广的服务,以推动各中小企业全面信息数字化,并利用创新技术帮助各行业提升企业形象和运营效率。

这篇文章将为大家详细讲解有关python2.6中pip安装失败怎么办,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

安装pip失败:

注意:使用python2.6.6安装,因为我的环境中python指向的是2.6.6,所以直接使用下面命令进得安装。

python get-pip.py

报错如下

[root@javen-zhao pip2.6]# python get-pip.py 

DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Collecting pip<10

  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/

  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/

  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/

  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/

  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/

  Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping

  Could not find a version that satisfies the requirement pip<10 (from versions: )

No matching distribution found for pip<10

解决方法:

1、使用如下命令安装python 2.6.6后可以正常安装pip。

./configure --prefix=/usr/local --with-ssl --enable-optimizations

其中--prefix=/usr/local是指定python安装的路径,安装后python2.6可执行脚本会在/usr/local/bin目录下

2、做上面操作时检查一下系统中是否有安装openssl-devel

检查openssl安装情况

[root@javen-zhao pip]# rpm -aq|grep openssl
openssl-devel-1.0.1e-57.el6.x86_64
openssl-1.0.1e-57.el6.x86_64

3、 如果没有openssl-devel使用yum 安装

[root@javen-zhao pip]# yum install openssl-devel

4、重新安装pip,安装成功后查看2.6.6环境下的pip版本信息

[root@javen-zhao pip2.6]# pip2.6 -V
pip 9.0.3 from /usr/local/lib/python2.6/site-packages (python 2.6)
[root@javen-zhao pip2.6]# whereis pip
pip: /usr/bin/pip /usr/bin/pip2.7 /usr/local/bin/pip2.6 /usr/local/bin/pip

安装成功。

关于python2.6中pip安装失败怎么办就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


网站名称:python2.6中pip安装失败怎么办-创新互联
本文路径:http://azwzsj.com/article/dghcjo.html