2014-12-02 136 views
0

我正試圖用pip安裝lxml。運行我的劇本時,我收到這個初始誤差:安裝lxml時出錯

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: xml. Do you need to install a parser library? 

快速搜索上面的錯誤(如here)透露我需要安裝LXML。

嘗試安裝LXML我收到以下錯誤:

clang: error: unknown argument: '-mno-fused-madd' 

error: command 'cc' failed with exit status 1 

任何想法是怎麼回事?

回答

1

根據Xcode 5 Release Notes

The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.

...

To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning. For example, you can install a Python native extension with:

$ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future \ 
    easy_install ExtensionName 

設置以下環境變量安裝lxml前:

export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future