首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >[674]AttributeError: module 'lib' has no attribute 'X509_up_ref'

[674]AttributeError: module 'lib' has no attribute 'X509_up_ref'

作者头像
周小董
修改2025-08-22 17:11:02
修改2025-08-22 17:11:02
2.9K00
代码可运行
举报
文章被收录于专栏:异常问题异常问题
运行总次数:0
代码可运行

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

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

解决办法

卸载再重装pyOpenSSL

代码语言:javascript
代码运行次数:0
运行
复制
pip uninstall pyOpenSSL
pip install pyOpenSSL

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

代码语言:javascript
代码运行次数:0
运行
复制
AttributeError: module 'lib' has no attribute 'X509_up_ref'

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

代码语言:javascript
代码运行次数:0
运行
复制
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
代码运行次数:0
运行
复制
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
代码运行次数:0
运行
复制
apt remove python3-openssl -y 
apt autoremove

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

代码语言:javascript
代码运行次数:0
运行
复制
apt install python3-openssl -y

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

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

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

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

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 解决办法
  • as root on Debian:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档