I've ju开发者_高级运维st installed Python 2.6.6 from sources and what I get:
>>> import hashlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/hashlib.py", line 136, in <module>
md5 = __get_builtin_constructor('md5')
File "/usr/local/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
Install openssl-dev
and rebuild.
I have just tested this on my 2.6.6 installation and I have had no such problem. You might want to try reinstalling. Also, I am not sure if the hashlib module can be installed separately, but you may want to try that as well.
Also, can you try importing specific functions from hashlib and give the output?
>>> from hashlib import sha512
because if you don't need MD5's, you could avoid the problem.
You should have a md5.so somewhere, if it's not on your python path, I think it could cause this problem. I've ran into this problem before.
Let me know if this helps.
精彩评论