ImportError: No module named _md5 - please help

Falcolas garrickp at gmail.com
Thu Oct 29 11:59:18 EDT 2009


On Oct 29, 9:13 am, user7304 <wadie... at gmail.com> wrote:
> Hi,
>
> I am trying to run a python script and got this error.
>
> >>import _md5
> >>ImportError: No module named _md5
>
> Googling the problem suggested that I install the 'py25-hashlib'.
>
> the following does not work for me 'sudo port install py25-hashlib' ,
> trying to install MacPorts raised many problems.
>
> My question is: any idea on how to install it using yum?
> I am running python 2.6.2 on a centos machine.
>
> Many thanks for your help.

Try using hashlib.md5. From the docs:

>>> import hashlib
>>> m = hashlib.md5()
>>> m.update("Nobody inspects")
>>> m.update(" the spammish repetition")
>>> m.digest()
'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

http://www.python.org/doc/2.5.2/lib/module-hashlib.html

Garrick



More information about the Python-list mailing list