Python:ImportError:没有名为_md5的模块

时间:2012-04-24 21:51:35

标签: python

我在我的Ubuntu 10.04 x86_64机器上安装了python 2.5.1。

当我尝试导入hashlib / md5时,我收到此错误

>>> 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

我尝试过在谷歌上找到的大部分解决方案,但对我来说没什么用。有谁知道如何解决这个问题?谢谢!

1 个答案:

答案 0 :(得分:7)

在从tarball配置和编译python之前,你必须安装包libssl-dev:

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

你有充分的理由不在2.5.X系列中使用最新版本吗?