Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: ImportError: No module named _md5

Tags:

python

I have python 2.5.1 installed on my Ubuntu 10.04 x86_64 machine.

When i try to import hashlib/md5, the i get this error

>>> import hashlib 
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/hashlib.py", line 133, in <module>
md5 = __get_builtin_constructor('md5')
File "/usr/local/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
import _md5
ImportError: No module named _md5

I have tried most of the solutions that I could find on google, but nothing works for me. Does anyone know how to solve this? Thank you!

like image 527
Chaos Avatar asked Apr 24 '12 21:04

Chaos


1 Answers

You have to have the package libssl-dev installed before configuring and compiling python from the tarball:

sudo apt-get install libssl-dev
cd YOUR_PYTHON_2.5_1_SRC_DIR
make clean
./configure
make
sudo make install

Do you have a good reason not to use the latest version in the 2.5.X series?

like image 57
Anthon Avatar answered Sep 26 '22 10:09

Anthon