在全新安装的ActivePython-2.6上,pip给出了一个导入错误

时间:2010-12-03 22:26:58

标签: python centos activepython

我在虚拟机上安装了Cent OS,它带有开箱即用的Python 2.4。我需要安装Python 2.6,所以我从ActivePython安装了一个单独的python二进制文件,它将自己安装在不同的目录中。当我运行pip(/opt/ActivePython-2.6/bin/pip)时,我收到此错误:

# pip
Traceback (most recent call last):
  File "/opt/ActivePython-2.6/bin/pip", line 9, in <module>
    load_entry_point('pip==0.8.1', 'console_scripts', 'pip')()
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 305, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 2244, in load_entry_point
    return ep.load()
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pip/__init__.py", line 10, in <module>
    from pip.basecommand import command_dict, load_command, load_all_commands, command_names
  File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pip/basecommand.py", line 11, in <module>
    import urllib2
  File "/opt/ActivePython-2.6/lib/python2.6/urllib2.py", line 93, in <module>
        import hashlib
  File "/opt/ActivePython-2.6/lib/python2.6/hashlib.py", line 136, in <module>
    md5 = __get_builtin_constructor('md5')
  File "/opt/ActivePython-2.6/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
    import _md5
ImportError: No module named _md5

我之前从未见过这个错误,我不明白为什么当库只是'md5'时它会尝试调用_md5。当我尝试将_md5.py符号链接到md5.py时,我得到了相同的错误,但是ImportError: No module named _md5

1 个答案:

答案 0 :(得分:0)

_md5.so中查找/opt/ActivePython-2.6并在其上运行ldd。呀。

安装EPEL,通过yum安装python26,玩得开心。