Site icon Amelt.net

python lxml:Install error – libxml/xmlversion.h: No such file or directory

Amelt

Amelt

This post is also available in: 日本語 (Japanese)

When I tried to install lxml(python library) in Docker's virtual environment(Ubuntu), I got the following error.
A similar error may appear in a freshly created LINUX development environment.

src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory

The problem seems to be just that the virtual environment(Ubuntu) library has not been updated, so update it with the following command.

sudo apt-get update
sudo apt-get install libxml2-dev libxslt1-dev

After that, if you run the pip command again, you will be install without any problems.

pip install lxml