分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

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

发布时间:2023-09-06 01:59责任编辑:白小东关键词:暂无标签

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

1.测试

[root@s011805161450 ~]# 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.查看

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

3.安装

[root@s011805161450 ~]# yum install openssl-devel -y

4.查看结果

[root@s011805161450 ~]# 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.测试结果

[root@s011805161450 ~]# 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'

原文地址:https://www.cnblogs.com/Gnnnny/p/9185126.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved