0
我在虛擬機上安裝了Cent OS,它附帶Python 2.4開箱即用。我需要安裝Python 2.6,所以我從ActivePython安裝了一個單獨的Python二進制文件,它將自己安裝在不同的目錄中。當我運行PIP(/opt/ActivePython-2.6/bin/pip
)我得到這個錯誤:在全新安裝的ActivePython-2.6上,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
。
_md5是md5.py導入的基礎編譯C庫;這裏使用C庫的包裝器來提高速度。 – 2010-12-03 22:42:59