我在安裝lxml到我的Mac OS時遇到問題。 構建它時出現以下錯誤。未能在MacOS中安裝lxml 10.8.4
brew install libxml2
brew link libxml2 --force
我是新至Mac:使用pip install lxml
/private/var/folders/9s/s5hl5w4x7zjdjkdljw9cnsrm0000gn/T/pip-build-khuevu/lxml/src/lxml/includes/etree_defs.h:9:10: fatal error: 'libxml/xmlversion.h' file not found
我已經安裝的libxml2與沖泡時,這是我的錯誤。在Ubuntu中,這意味着必須安裝libxml2-dev軟件包。
更新:這裏是pip.log:
"~/.pip/pip.log" 124L, 8293C requirement_set.install(install_options, global_options, root=options.root_path) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1185, in install requirement.install(install_options, global_options, *args, **kwargs) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 592, in install cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/util.py", line 662, in call_subprocess % (command_desc, proc.returncode, cwd)) InstallationError: Command /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;file='/private/var/folders/9s/s5hl5w4x7zjdjkdljw9cnsrm0000gn/T/pip-build-khuevu/lxml/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/9s/s5hl5w4x7zjdjkdljw9cnsrm0000gn/T/pip-nsV0iT-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/var/folders/9s/s5hl5w4x7zjdjkdljw9cnsrm0000gn/T/pip-build-khuevu/lxml
任何想法? 非常感謝
是否有錯誤消息在'〜/將該.pip/pip.log'?用'brew'安裝'libxml2'後,你在'/ usr/include/libxml2/libxml'中看到了正確的頭文件嗎? libxml2'頭文件是否在你的路徑上? – ChrisP
@ChrisP,我用日誌更新了我的問題。我的機器中沒有/ usr/include文件夾。 –
希望有人來過,誰知道發生了什麼事。我現在唯一的建議是確保可以通過PATH訪問libxml2頭文件。 Homebrew應該默認安裝到'/ usr/local',它在PATH上。你能在你的機器上找到'xmlversion.h'文件,只是爲了確保它在那裏?如果你一直有問題,我推薦[Enthought](http://www.enthought.com)Python發行版,默認情況下很多工具很難創建(包括'lxml')。我知道這並不能解決你確切的問題。 – ChrisP