How to fix Python Installation Error while loading shared libraries: [Solved]

Updated on September 2, 2017

Question: Thanks to the guide on How to compile and install Python with OpenSSL Support. However, the installation failed with an error message error while loading shared libraries: cannot open shared object file during make. According to the installation guide, I installed OpenSSL and then edited Setup.dist file to refer the OpenSSL installation path. The OpenSSL installation directory is /usr/local/openssl. 

Below is the complete error message:

[Python-3.5] $ make
 ./python: error while loading shared libraries: cannot open shared object file: No such file or directory
 make: *** [pybuilddir.txt] Error 127

Please suggest a solution.


There are few things that you might need to check:

python openssl error

1) OpenSSL developer package will provide all necessary SSL libraries. Make sure openssl-devel package is installed as shown below:

# rpm -qa |grep openssl

If rpm -qa lists openssl-devel, then you mostly probably have libssl libraries installed. If not, you need to install it first.

# yum install openssl-devel

2) Check for libssl and libcrypto shared object files: Look out for the lib folder under OpenSSL installation directory (in case of yum install, the libraries might be present in /usr/lib or /usr/lib64). For example, if the OpenSSL is installed in /usr/local/openssl, then you will find lib folder containing library files as shown below:

Sample output:

# cd /usr/local/openssl/lib
# ls
engines libssl.a
libcrypto.a pkgconfig

Lookout for the libssl and libcrypto shared object files.

3) Set library to the path: You might have the libraries installed, but may not be in the path. Add OpenSSL libraries to file as shown below:

# vim /etc/

Add below line to the end of the file:


Note: The path might vary depending upon your installation.

# ldconfig

Hope it works.

Was this article helpful?

Related Articles

Leave a Comment