如何在Mac OS X 10.7.4上安装lxml?我已经用尽了所有选择 [英] How do I install lxml on Mac OS X 10.7.4? I have exhausted all options

查看:206
本文介绍了如何在Mac OS X 10.7.4上安装lxml?我已经用尽了所有选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试了各种途径,但没有运气.我正在使用10.7.4的MBP.我不记得上一次我在Mac上使用Python安装任何东西时遇到了很多问题.请帮助我在本地计算机上使用lxml,而不要依赖SVN提交,这些更新可以在Linux计算机上远程运行.

Tried various avenues but no luck. I am using a MBP with 10.7.4. I don't remember the last time I had so many problems installing anything with Python on my Mac. Please help me use lxml on my local machine and not rely on SVN commits, updates to remotely run on the Linux machine.

$ sudo STATIC_DEPS=true /usr/bin/easy_install-2.7 lxml
Password:
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.3.4
Downloading http://lxml.de/files/lxml-2.3.4.tgz
Processing lxml-2.3.4.tgz
Running lxml-2.3.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-mbyEtk/lxml-2.3.4/egg-dist-tmp-O_t_3P
Building lxml version 2.3.4.
Latest version of libiconv is 1.14
Downloading libiconv into libs/libiconv-1.14.tar.gz
error: [Errno 60] Operation timed out

在没有运气的情况下尝试了以下

Tried the following with no luck

$ python setup.py build

$ STATIC_DEPS=true sudo easy_install --allow-hosts=lxml.de,*.python.org lxml
$ sudo pip install lxml

llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/usr/include/libxml2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.7-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace

unable to execute llvm-gcc-4.2: No such file or directory

error: command 'llvm-gcc-4.2' failed with exit status 1

推荐答案

我首先安装了 MacPorts ,然后:

I first installed MacPorts and then:

$ sudo port install python27 py27-lxml

这使我可以正常运行lxml安装.

And this gave me a functioning lxml installation.

关于错误消息,您似乎缺少了pip用于构建lxml的编译器命令(llvm-gcc-4.2).您是否安装了OS X开发工具?您应该在/usr/bin/llvm-gcc-4.2中找到该文件.如果不存在,则可能需要下载并安装开发包.

Regarding your error messages, you appear to be missing the compiler command that pip is using to build lxml (llvm-gcc-4.2). Do you have the OS X development tools installed? You should find that file in /usr/bin/llvm-gcc-4.2; if it's not there, you probably need to download and install the development package.

您可以通过App Store安装XCode开发人员工具.如果您在应用商店中阅读了评论,您会注意到,为了使命令行工具可用,您需要单独安装它们.在XCode中,转到首选项"->下载",然后下载命令行工具"包.

You can install the XCode developer tools via the App Store. If you read the comments in the app store, you'll note that in order to make the command line tools available you need to install them separately. In XCode, go to Preferences->Downloads and download the "Command line tools" package.

这篇关于如何在Mac OS X 10.7.4上安装lxml?我已经用尽了所有选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆