python - 使用 pip 安装 lxml 时遇到问题

标签 python macos pip

我尝试使用以下命令在 Mac OSx 10.11 上安装此库:

sudo -H pip install lxml

当我不断收到此消息时:

#include "libxml/xpath.h"
         ^
1 error generated.
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
Perhaps try: xcode-select --install
*********************************************************************************
error: command 'cc' failed with exit status 1

但是我很确定 libxml2 已安装在这里:

/usr/local/Cellar/libxml2/2.9.2/include/libxml2

我使用brew来安装这个包。应该没有什么问题。我应该如何修复它?

最佳答案

Homebrew 不链接 libxml 和 libxslt 以避免冲突。您需要--force它们。

brew link libxml2 --force
brew link libxslt --force

当我升级到最新的 OS X 时,我遇到了这个问题。我写了一个 blog post上面详细说明了问题。

关于python - 使用 pip 安装 lxml 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34240287/

相关文章:

c - Mac OS X 塞拉利昂 : Undefined symbols for architecture x86_64

python - 无法在 Windows 中安装 Pillow

Python抛出ValueError : is not in list although it's there in list

python - get_queryset 函数上的 Django :"RuntimeError: maximum recursion depth exceeded"

cocoa - 网页 View 问题

c++ - 在 Mac 上构建 iotivity

python - Azure应用程序服务找不到已安装的模块

python-2.7 - 当我同时拥有 python2 和 python3 时,如何通过 pip 安装 python2 软件包?

python - 如何使用 BeautifulSoup 收集数据 python

python - 如何使用 OpenCV 理解 Python 中的头部姿势估计角度?