Certain important Python libraries require the
hashlib module, which itself
depends on the "_sha256" module. By default, Python2.6 does not include
_sha256 as part of the standard library without some extra work.
If you're on a relatively new Ubuntu version but still need to maintain backwards compatability with a Python2.6 program, shared library directory changes in Ubuntu can lead to conflicts.
This solution is nearly identical to the solution for no module named zlib.
Ensure the following packages are installed
$ sudo apt-get install libssl-dev
Download the latest source of Python2.6 (which is Python 2.6.9 at the time of this article)
~$ cd /tmp /tmp$ wget "https://www.python.org/ftp/python/2.6.9/Python-2.6.9.tgz" /tmp$ tar -xf Python-2.6.9.tgz
This post on UbuntuForums outlines the issues with Python2.6 compatibility with newer Ubuntu versions.
It is Ubuntu's "fault". They changed where shared libraries are placed in
order to support multiple architectures better (eg both x86 and x86_amd64 on the
same machine) in a way that diverges from how it has always been done in the
Upstream Python is being patched, but that doesn't really help as they are only
doing it with current versions of Python
So we need to locate the libssl shared library file and move it to a place where Python can locate it.
Locating the libssl file
First, cd to the
$ cd /lib
Now we will find the exact libssl shared library file via the
/lib$ find . -name "libssl*" ./i386-linux-gnu/libssl.so.1.0.0
My libssl file was located at
./i386-linux-gnu/libssl.so.1.0.0. Your libssl file
may be in a different directory.
We will now create a symlink to libssl file that was returned by the find command above.
/lib$ sudo ln -s ./i386-linux-gnu/libssl.so.1.0.0 libssl.so
Now head back over to the Python-2.6.9 directory we untarred earlier.
/lib$ cd /tmp/Python-2.6.9
Now we compile from source
/tmp/Python-2.6.9$ ./configure /tmp/Python-2.6.9$ make && sudo make altinstall
/tmp/Python-2.6.9$ python2.6 Python 2.6.9 (unknown, Sep 6 2015, 20:22:36) [GCC 4.8.2] on linux3 Type "help", "copyright", "credits" or "license" for more information. >>> import hashlib >>>
\o\ /o/ \o\ /o/ \o\ /o/ \o\ /o/