Tag Archives: lxml

Mac: Python Install lxml Error: Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed

Failed to 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

After installing libxml2, I still prompted this error, and finally found the problem after a lot of trouble

Need to add C_ INCLUDE_ Path to the libxml2 path in Xcode MacOS SDKs

sudo C_ INCLUDE_ PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2/

And then in execution

xcode-select --install
pip install lxml