【问题标题】:Cannot install lxml 3.3.3 on OSX 10.9 with buildout无法在带有构建的 OSX 10.9 上安装 lxml 3.3.3
【发布时间】:2014-05-10 05:55:01
【问题描述】:

看过很多相关的帖子,但没有任何运气让它发挥作用。日志显示:

We have no distributions for lxml that satisfies 'lxml'.
Getting distribution for 'lxml'.
Running easy_install:
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python" "-c" "from setuptools.command.easy_install import main; main()" "-mZUNxd" "/Users/brad/Development/python/eggs/tmpLpoVC3" "-q" "/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/tmpZx0t7aget_dist/lxml-3.3.3.tar.gz"
path=/Users/brad/Development/python/eggs/setuptools-0.7.2-py2.7.egg

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
  warnings.warn(msg)
In file included from src/lxml/lxml.etree.c:346:
/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/easy_install-XSC3pm/lxml-3.3.3/src/lxml/includes/etree_defs.h:9:10: fatal error: 'libxml/xmlversion.h' file not found
#include "libxml/xmlversion.h"
         ^
1 error generated.
error: Setup script exited with error: command '/usr/bin/clang' failed with exit status 1Building lxml version 3.3.3.
Building without Cython.
ERROR: /bin/sh: xslt-config: command not found

** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt 

An error occurred when trying to install lxml 3.3.3. Look above this message for any errors that were output by easy_install.
While:
  Installing pydev.
  Getting distribution for 'lxml'.
Error: Couldn't install: lxml 3.3.3

来自Cannot install Lxml on Mac os x 10.9 的尝试答案。

xcode-select --install 最初工作,直到 XCode 升级到 10.5。然后从那以后就没有工作了(即使重试了这条线)。现在我总是得到Can't install the software because it is not currently available from the Software Update server

试过这个STATIC_DEPS=true pip install lxml。它安装时出现错误:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: command 'cc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip-4lSNM3-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml
Storing debug log for failure in /Users/brad/Library/Logs/pip.log

该日志文件以:

结尾
Cleaning up...
  Removing temporary dir /private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip-4lSNM3-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml
Exception information:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip-4lSNM3-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/3c/mdys56lx2wbf9rjlmqy4nhy40000gn/T/pip_build_brad/lxml

创建符号链接 (https://stackoverflow.com/a/19549645/1399659) 也无济于事。

感谢您的想法,谢谢

【问题讨论】:

    标签: python macos lxml


    【解决方案1】:

    好的,所以再次以新的眼光回到这个问题,设法解决了它。

    上面pip install lxml 中的错误clang: error: unknown argument: '-mno-fused-madd' 是关键。我发现了它和https://stackoverflow.com/a/22578811/1399659,但无法让另一个 python 版本工作。尝试过 MacPorts 和 Homebrew。

    最后来自https://stackoverflow.com/a/17439319/1399659 的提示让我删除了 macport 的 lxml 和系统安装的 pip。然后重新安装 HomeBrew 的 python(偶尔强制链接),让我使用它安装的 pip 运行 bog-standard pip install lxml

    现在运行 Homebrew 的 python 2.7.6 和 pip,用于安装 lxml 3.3.3

    【讨论】:

    • 用 MacPorts 再次尝试了这个(只是因为我有更多的历史),但似乎没有 pip 端口。如果您使用 /usr/local/bin/pip 中的 MacPorts python 覆盖第一行的 python 解释器,则使用系统 easy_install 安装 pip 即可。但是在尝试 pip install lxml 时它没有模块 pkg_resources 失败。所以现在回到 HomeBrew
    • 那没用!所以我上面的“答案”并没有被证明是可重复的。与原始问题相同的错误。
    • 仅供参考:MacPorts 为所有受支持的 Python 版本提供 pip 端口;对于 2.7,port install py27-pipunknown argument 错误是 Apple 系统 Python 与 Xcode 5.1 一起使用时的错误;已在 OS X 10.9.3 中修复。
    猜你喜欢
    • 2014-05-28
    • 2013-11-02
    • 2014-08-23
    • 2013-12-25
    • 2013-11-30
    • 2014-04-12
    • 1970-01-01
    • 2010-12-03
    相关资源
    最近更新 更多