Tutorial Example

Fix AttributeError: cffi library ‘_openssl’ has no function, constant or global variable named ‘Cryptography_HAS_ECDH’

AttributeError: cffi library ‘_openssl’ has no function, constant or global variable named ‘Cryptography_HAS_ECDH’‘ error often occur if you are using cryptography. In this tutorial we will discuss how to fix this error.

Why this error occur?

The reason is your OpenSSL version is not 1.1.1 and cryptography can not support it. To fix this error, you can update your openssl from 1.0 to 1.1.1.

There are two ways to fix this AttributeError.

Method 1. Use python 3.7

Python 3.7 supports openssl 1.1.1 version defaulty, which means we can use python 3.7 to fix this error. We have tested. It works.

Method 2.Update OpenSSL from 1.0 to 1.1.1

Changing python version to support openssl 1.1.1 is not a good choice. The best way is to update openssl version. As to me, i have installed many python libraries on python 3.5 version. If i change python to 3.7 version. These libraries need updated.

How to update OpenSSL from 1.0 to 1.1.1? You can refer to this tutorial.

Make Python 3.5 Support OpenSSL 1.1.1 Version: A Complete Guide – Python Tutorial