(转)输入pipt提示:AttributeError: 'module' object has no attribute 'HTTPSConnection'

Posted gnnnny

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(转)输入pipt提示:AttributeError: 'module' object has no attribute 'HTTPSConnection'相关的知识,希望对你有一定的参考价值。

文章转自:http://write.blog.csdn.net/postedit/51725016

1.测试

[[email protected] ~]# python

Python 2.7.8 (default, Jun 17 2016, 01:25:39) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/ssl.py", line 60, in <module>
    import _ssl             # if we can‘t import it, let the error propagate

ImportError: No module named _ssl

2.查看

[[email protected] ~]# yum list installed | grep ssl
openssl.x86_64          1.0.0-27.el6    @anaconda-CentOS-201303020151.x86_64/6.4

3.安装

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

4.查看结果

[[email protected] ~]# rpm -aq|grep openssl
openssl-1.0.1e-48.el6_8.1.x86_64
openssl-devel-1.0.1e-48.el6_8.1.x86_64

5.重新编译python

 

#修改Setup文件
vi /usr/software/Python-2.7.5/Modules/Setup
#修改结果如下:
# Socket module helper for socket(2)
_socket socketmodule.c timemodule.c

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
_ssl _ssl.c
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl
-L$(SSL)/lib -lssl -lcrypto

6.重新编译

make
make install

7.测试结果

[[email protected] ~]# python
Python 2.7.8 (default, Jun 21 2016, 17:51:18) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _ssl
>>> exit()


























以上是关于(转)输入pipt提示:AttributeError: 'module' object has no attribute 'HTTPSConnection'的主要内容,如果未能解决你的问题,请参考以下文章

Java基础,关于流程控制的问题:输入错误,提示错误并且重新输入。 这个快把我整崩溃了,请大家帮帮我

Eclipse常用设置(转)

[转]连接远程桌面提示: 之前用于连接到的凭据无法工作...的解决办法

转Xcode方法提示不显示的解决办法

DELPHI中MessageBox的用法 (转)

DELPHI中MessageBox的用法 (转)