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

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

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

解决办法

卸载再重装pyOpenSSL

pip uninstall pyOpenSSL
pip install pyOpenSSL

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

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

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

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:

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:

apt remove python3-openssl -y 
apt autoremove

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

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

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

周小董

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值