【发布时间】:2012-03-24 19:48:47
【问题描述】:
我正在尝试在 OS X 10.6.8 上为 python 安装 lxml
我根据对安装 lxml 的问题的回答在终端中运行了sudo env ARCHFLAGS="-arch i386 -arch x86_64" easy_install lxml:https://stackoverflow.com/a/6545556/216336
这是该命令的输出:
MYCOMPUTER:~ MYUSERNAME$ sudo env ARCHFLAGS="-arch i386 -arch x86_64" easy_install lxml
Password:
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.3.3
Downloading http://lxml.de/files/lxml-2.3.3.tgz
Processing lxml-2.3.3.tgz
Running lxml-2.3.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ytPLAc/lxml-2.3.3/egg-dist-tmp-NgYLdF
Building lxml version 2.3.3.
Building without Cython.
Using build configuration of libxslt 1.1.24
Adding lxml 2.3.3 to easy-install.pth file
Installed /Library/Python/2.6/site-packages/lxml-2.3.3-py2.6-macosx-10.6-universal.egg
Processing dependencies for lxml
Finished processing dependencies for lxml
这对我来说看起来很成功,但是当我尝试在 python 中导入 lxml 时出现导入错误...
Last login: Sat Mar 24 15:26:04 on ttys000
MYCOMPUTER:~ MYUSERNAME$ python2.7
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lxml
它似乎已安装到 2.6 并且我正在运行 2.7 的事实似乎是一个线索,但我不知道该怎么办。
【问题讨论】:
标签: python macos installation lxml python-import