简体   繁体   English

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

[英]Python: ImportError: No module named _md5

I have python 2.5.1 installed on my Ubuntu 10.04 x86_64 machine.我的 Ubuntu 10.04 x86_64 机器上安装了 python 2.5.1。

When i try to import hashlib/md5, the i get this error当我尝试导入 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

I have tried most of the solutions that I could find on google, but nothing works for me.我已经尝试了可以​​在 google 上找到的大多数解决方案,但对我来说没有任何效果。 Does anyone know how to solve this?有谁知道如何解决这个问题? Thank you!谢谢!

You have to have the package libssl-dev installed before configuring and compiling python from the tarball:在从 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

Do you have a good reason not to use the latest version in the 2.5.X series?你有充分的理由不使用 2.5.X 系列的最新版本吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM