我在安装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