When installing a python module, if you see similar error like ImportError: libffi.so.6: cannot open shared object file: No such file or directory
—————————————-
Command “/usr/local/bin/python2.7 -c “import setuptools, tokenize;__file__=’/tmp/pip-build-RZWd8I/cryptography/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(__file__).read().replace(‘\r\n’, ‘\n’), __file__, ‘exec’))” install –record /tmp/pip-nle_4p-record/install-record.txt –single-version-externally-managed –compile” failed with error code 1 in /tmp/pip-build-RZWd8I/cryptography
It is normally caused by that the file location is not in the python sys.path. The fix is to add this file path to environmental variable LD_LIBRARY_PATH
Example:
[root@myserver ~]# find / -name libffi.so.6
/usr/local/lib64/libffi.so.6
/root/libffi-3.2.1/x86_64-unknown-linux-gnu/.libs/libffi.so.6
[root@myserver~]# echo $LD_LIBRARY_PATH
[root@myserver ~]# export LD_LIBRARY_PATH=”/usr/local/lib64/”
To fix this issue on Debian, run ‘sudo apt-get install libffi6’