Python:导入错误:没有名为_md5 的模块

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

我已经尝试了在 google 上可以找到的大部分解决方案,但对我来说没有任何效果。有谁知道如何解决这个问题?谢谢!

最佳答案

在从 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 系列中的最新版本吗?

关于Python:导入错误:没有名为_md5 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10306531/

相关文章:

python - Tox 在安装模块时无法复制非 python 文件

python - 如果列值来自不同的文件,如何将列插入到数据框中?

python - 如何向 django 管理面板添加自定义 View 和操作?

python - 以非常高的质量在 Python 中保存图像

python - 是否有 pandas 函数可以比较每行中的不同列值?

python - Gtk3 和 Python - 框不会调整大小以填充窗口

python - 尽管格式正确, Pandas 仍无法推断时间序列频率?

python - 在 Ubuntu Python 2.7 中读取 os.system() 命令的输出

python - 从 dict 继承类的术语

python - 堆积柱