【发布时间】:2011-04-07 04:33:01
【问题描述】:
代码
from lxml import etree
产生错误
ImportError: No module named lxml
跑步
sudo easy_install lxml
结果
lxml 2.2.7 is already the active version in easy-install.pth
Removing lxml-2.2.7-py2.5-macosx-10.3-i386.egg from site-packages and rerunning sudo easy_install lxml results in
Adding lxml 2.2.7 to easy-install.pth file
Installed /Library/Python/2.5/site-packages/lxml-2.2.7-py2.5-macosx-10.3-i386.egg
Processing dependencies for lxml
Finished processing dependencies for lxml
但我仍然得到 No module named lxml
为了在我的 Mac (OSX 10.5) 上使用 lxml,我缺少什么步骤?
更新
python --version 报告
Python 2.5.2
运行 python 产生
Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
【问题讨论】:
-
正如预期的那样,这似乎不是 Apple 在 10.5 中提供的 Python 2.5(即 Python 2.5.1)。试试
python -c 'import sys;print sys.executable'确定。