Install lxml in python3 in windows

Source: Internet
Author: User
This article briefly introduces how to install the LXML module using Python in windows and linux systems. It is very simple and practical, if you have any need, refer to lxml as the most abundant and easy-to-use library related to XML and HTML in Python. Lxml is not a Python package, but a Python-based binding between libxml2 and libxslt libraries. What makes it different is that it takes into account the speed and functional integrity of these libraries, as well as the simplicity of pure Python APIs. It is compatible with the well-known ElementTree API, but is superior to it! However, installing lxml is a little troublesome. Because of the dependency, if you install lxml directly, easy_install and pip cannot succeed, and a gcc error will be reported.

LXML is usually installed for crawlers.

 pip install lxml

Solution to the following error:

 lxml Unable to find vcvarsall.bat

1. Install wheel and run the following command:

 pip install wheel

2. Download the corresponding. whl file here (open the URL and press ctrl + F to search for LXML, select the corresponding version, generally win32, rather than win_arm64, even if the computer is win64)

Http://www.lfd.uci.edu /~ Gohlke/pythonlibs/# lxml

3. Go to the folder where. whl is located-> shift + right-click-> open the command window here

4. Execute the command to complete the installation:

 pip install lxml-3.6.0-cp35-cp35m-win32.whl

Additionally, the installation of LXML in Linux is attached.

The packages that lxml depends on are as follows:

Libxml2, libxml2-devel, libxlst, libxlst-devel, python-libxml2, python-libxslt

The installation steps are as follows:

Step 1: Install libxml2

$ sudo apt-get install libxml2 libxml2-dev 

Step 2: Install libxslt

$ sudo apt-get install libxlst libxslt-dev 

Step 3: Install python-libxml2 and python-libxslt

$ sudo apt-get install python-libxml2 python-libxslt

Step 4: Install lxml

$ sudo easy_install lxml 

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.