前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >AttributeError: module 'lib' has no attribute 'X509_up_ref'

AttributeError: module 'lib' has no attribute 'X509_up_ref'

作者头像
周小董
发布2019-10-22 15:13:47
2.6K0
发布2019-10-22 15:13:47
举报
文章被收录于专栏:python前行者python前行者

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://blog.csdn.net/xc_zhou/article/details/102507341

AttributeError: module ‘lib’ has no attribute ‘X509_up_ref’

主要原因是系统当前的python和pyOpenSSL版本不对应

解决办法

卸载再重装pyOpenSSL

代码语言:javascript
复制
pip uninstall pyOpenSSL
pip install pyOpenSSL

No matter what module I try to install via pip3 install I always get the same error :

代码语言:javascript
复制
AttributeError: module 'lib' has no attribute 'X509_up_ref'

Have no idea how to solve this one. Anyone had this issue before?

代码语言:javascript
复制
gabriel@E1-522:~$ pip3 install ipaddress

Collecting ipaddress

From cffi callback <function _verify_callback at 0x7f0d2e0419d8>:

Traceback (most recent call last):

File "/usr/local/lib/python3.6/dist-packages/OpenSSL/SSL.py", line 313, 

in wrapper

_lib.X509_up_ref(x509)

AttributeError: module 'lib' has no attribute 'X509_up_ref'

Could not find a version that satisfies the requirement ipaddress 
(from versions: )

No matching distribution found for ipaddress

The same error while trying to install a different module:

代码语言:javascript
复制
gabriel@E1-522:~$ pip3 install cryptography

Collecting cryptography

From cffi callback <function _verify_callback at 0x7fd515d659d8>:

Traceback (most recent call last):

File "/usr/local/lib/python3.6/dist-packages/OpenSSL/SSL.py", line 313, in wrapper

_lib.X509_up_ref(x509)

AttributeError: module 'lib' has no attribute 'X509_up_ref'

Could not find a version that satisfies the requirement cryptography 

(from versions: )

No matching distribution found for cryptography

I run Ubuntu 17.10 . I have both python 2.7 and 3.6

Thank you.

This is what resolved it for me:

as root on Debian:

代码语言:javascript
复制
apt remove python3-openssl -y 
apt autoremove

Made sure that /usr/local/lib/python3.5/dist-packages/OpenSSL/SSL.py was removed.

代码语言:javascript
复制
apt install python3-openssl -y

Then, pip3 was able to install again, and I lived happily ever after.

参考:https://unix.stackexchange.com/questions/438595/attributeerror-module-lib-has-no-attribute-x509-up-ref

https://blog.csdn.net/mouday/article/details/80242597

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-10-11 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 解决办法
  • as root on Debian:
相关产品与服务
SSL 证书
腾讯云 SSL 证书(SSL Certificates)为您提供 SSL 证书的申请、管理、部署等服务,为您提供一站式 HTTPS 解决方案。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档