Python pip installation lxml failed (GO)

Source: Internet
Author: User

Today want to try Beautifulsoup4, the installation is very smooth, and then ready to install lxml as a parser, did not expect to install the PIP directly to me a full page error.

Resolution process

Look at the error message, which has the following paragraph:

*********************************************************************************Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?*********************************************************************************

So I manually installed the library, and found that it has actually been installed, then why do you prompt this problem? So I went back to see the output hints, found the two lines:

ERROR: b‘/bin/sh: 1: xslt-config: not found\n‘** make sure the development packages of libxml2 and libxslt are installed **
    • 1
    • 2
    • 1
    • 2

The original to install the dev package ah. Input sudo apt-get install libxml2-dev libxslt1-dev , should it be done?

It turned out that I was happy too early, though no longer reported this mistake, but the installation of lxml failed. Helpless, can only continue to see error tips. An error message was found:

src/lxml/lxml.etree.c:82:20: fatal error: Python.h: 没有那个文件或目录
    • 1
    • 1

Check, this is python-dev a header file provided in, so need to install python-dev (I use Python3, so installed python3-dev ). Install with APT, and then use pip install lxml , did not think that still error can not install Orz. This time the mistake changed one:

/usr/bin/ld: cannot find -lz
    • 1
    • 1

StackOverflow on this issue to provide the method is installed zlib1g-dev , with Apt-get after installation, try to lxml again, finally compile the installation successfully.

Summarize

In fact, with one command, a few dev packs are needed to get it done.

sudo apt-get install python-dev python3-dev libxml2-dev libxslt1-dev zlib1g-dev
    • 1
    • 1

It was later discovered that someone on StackOverflow had asked the question.

Turn http://blog.csdn.net/lincifer/article/details/51296559

Python pip installation lxml failed (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.