gpt4 book ai didi

python - 如何在 Mac OS X 10.7.4 上安装 lxml?我已经用尽了所有的选择

转载 作者:太空狗 更新时间:2023-10-29 22:16:36 25 4
gpt4 key购买 nike

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

$ 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

尝试了以下但没有成功

$ python setup.py 构建

$ 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然后:

$ sudo port install python27 py27-lxml

这给了我一个正常运行的 lxml 安装。

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

您可以通过 App Store 安装 XCode 开发人员工具。如果您阅读应用商店中的评论,您会注意到为了使命令行工具可用,您需要单独安装它们。在 XCode 中,转到 Preferences->Downloads 并下载“Command line tools”包。

关于python - 如何在 Mac OS X 10.7.4 上安装 lxml?我已经用尽了所有的选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10666578/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com