Python安装后找不到ssl模块怎么办,如何处理
Admin 2022-07-12 群英技术资讯 701 次浏览
python安装完毕后,提示找不到ssl模块:
[www@pythontab.com ~]$ python Python 2.7.15 (default, Oct 23 2018, 18:08:43) [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] 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/python27/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 >>>
[www@pythontab.com ~]$ rpm -aq|grep openssl openssl-0.9.8e-20.el5 openssl-0.9.8e-20.el5 [www@pythontab.com ~]$
[www@pythontab.com ~]$ yum install openssl-devel -y #查看安装结果 [www@pythontab.com ~]$ rpm -aq|grep openssl openssl-devel-1.0.1e-57.el6.x86_64 openssl-1.0.1e-57.el6.x86_64
修改Setup文件
vi /src/Python-2.7.15/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
进入源码目录,重新编译安装
[www@pythontab.com ~]$ cd /src/Python-2.7.15/ [www@pythontab.com ~]$ make [www@pythontab.com ~]$ make install
5. 测试,已可正常使用。
[www@pythontab.com ~]$ python Python 2.7.15 (default, Oct 23 2018, 19:08:43) [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ssl >>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
这篇文章主要为大家介绍了tensorflow可视化Keras框架中Tensorboard使用示例,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
Python 数字类型用于数值的储存。数值类型是不允许改变的,如果改变数字数据类型的值,将重新分配内存空间。
这篇文章主要给大家分享Python条件语句的用法,对新手学习条件语句具有一定的借鉴和学习价值,感兴趣的朋友可以参考一下,希望大家阅读完这篇文章能有所收获,下面我们一起来学习一下吧。
这篇文章主要介绍了python中序列的逆序方式,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
这篇文章主要介绍了Python爬虫Xpath定位数据的方法,第一种方法直接右键,将文章路径复制下来点击Copy full Xpath,方法二使用@制定标签属性,搜索指定位置,每种方法给大家介绍的非常详细,需要的朋友可以参考下
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008