alvinzoo
alvinzoo

Reputation: 513

Trouble installing lxml with pip

I am trying to install this library on Mac OSx 10.11 using this command:

sudo -H pip install lxml

While I keep getting this message:

#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

Yet I am pretty sure that libxml2 is installed here:

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

I used brew to install this package. There shouldn't be any problem. How should I fix it?

Upvotes: 1

Views: 1444

Answers (1)

masnun
masnun

Reputation: 11906

Homebrew doesn't link libxml and libxslt to avoid conflicts. You need to --force them.

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

I faced this problem when I upgraded to latest OS X. I wrote a blog post on it detailing the issue.

Upvotes: 3

Related Questions