2014-03-31 65 views
0

已經看過很多相關帖子,但沒有任何運氣讓它工作。日誌顯示:無法在OSX 10.9上安裝lxml 3.3.3,並進行編譯

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。它安裝了錯誤:

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)沒有幫助:

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 

該日誌文件結尾。

想法表示讚賞,感謝

回答

0

好了,回來這與新鮮的眼光,再次設法解決這個問題。

錯誤clang: error: unknown argument: '-mno-fused-madd'上面的pip install lxml是緊俏。我發現它和https://stackoverflow.com/a/22578811/1399659,但無法獲得另一個Python版本的工作。曾嘗試過MacPorts和Homebrew。

最後,https://stackoverflow.com/a/17439319/1399659的一個提示讓我刪除了macport的lxml和系統安裝的pip。然後安裝自制的蟒蛇在新鮮的(偶爾強制鏈接),讓我用它的安裝PIP跑沼澤標準pip install lxml

現在運行自制軟件的蟒蛇2.7.6和點子,這是用來安裝LXML 3.3.3

+0

用MacPorts再次嘗試這個(因爲我有更多的歷史),但似乎沒有一個點端口。如果用/ usr/local/bin/pip中的MacPorts python覆蓋第一行的python解釋器,則可以使用系統easy_install安裝pip。 但是,當嘗試pip安裝lxml時,沒有模塊pkg_resources失敗。所以回到現在的HomeBrew –

+0

而那並沒有奏效!所以我上面的'答案'沒有被證明是可重複的。與原始問題相同的錯誤。 –

+1

供參考:MacPorts爲所有支持的Python版本提供'pip'端口;對於2.7,'port install py27-pip'。而且'unknown argument'錯誤是Apple X系列5.1中使用的Pythons系統中的一個bug;這已在OS X 10.9.3中修復。 –