How to install Python third-party libraries under Windows lxml

Source: Internet
Author: User

lxml is a very useful Python library, it can be flexible and efficient parsing of XML, and BeautifulSoup, requests, is the standard posture to write crawlers.

    • Refer to how to install Python third-party libraries under Windows lxml article in 16, this article updates and explains it in detail
Tools/Materials
+ python+ pip+我的电脑  win7 + 64位
Method overview
    • The following steps are prerequisites:
      1. Python is installed,
      2. The PIP is already installed.
      3. The Scripts directory under the Python installation directory (such as D:\Python27\Scripts) has been added to the system environment variable path.
        Installation and construction python2.* and 3.* environment detailed steps
    • Method One: Open cmd and enter pip install lxml. If the installation is successful, you can not look down, the character is too good. Usually, there are all kinds of errors, not the wrong, that is, there is wrong, anyway, it is a variety of installation.

    • Method Two: Basically, to come here to see the people, should have fallen into the pit, so directly from here to see. It is recommended to install through the lxml. WHL file.
Install by lxml. WHL file
    1. Open cmd, enter pip install wheel, install the wheel library before installing the. whl file.

    2. Enter Python (Idie or CMD, which is explained in general cmd). In cmd, enter python into Python.
      Then enter import Pip;print (pip.pep425tags.get_supported ()) to output the current Python version information on the interface.

With the consistent, python2.7.14 version, enter Python, enter import lxml , and prove that I did not install the lxml package.

    1. Download lxml. WHL file from official website straight chain lxml. Note In the version information that is marked, the corresponding version should be downloaded from the webpage:

The former author of the lxml3.6.4 version of the official website has been updated iteratively, here with the latest lxml4.1.1 version

According to your own configuration control download;

    1. Go to the folder where you downloaded the file, hold down the SHIFT key, and click the right mouse button to select "Open Command Window Here" in the pop-up menu.

    2. In the command window that opens, enter the full name of the PIP install "WHL file", which is the PIP install LXML-4.1.1-CP27-CP27M-WIN_AMD64.WHL, waiting for the installation to complete.

      If it fails, the following error is reported:

      32-bit and 64-bit differences are small; My computer python2.7.14 using 64-bit failure, 32-bit installation succeeded

    3. Enter Python, import lxml, no error, that means the installation is successful.

Precautions

If Python2 and Python3 are installed at the same time in the computer, the version Python2 and Python3 can be installed is not the same, note the print (pip.pep425tags.get_supported ()) to view, Do not assume that Python3 is LXML-3.6.4-CP35-CP35M-WIN_AMD64.WHL, then Python2 is LXML-3.6.4-CP27-CP27M-WIN_AMD64.WHL.

Python2 after successful installation of python3.6.4;

Enter Python, enter import lxml, error, prompt does not install Lxml,python2 and Python3 required version is not the same;
Here I downloaded several cp27 (Python2 used, 32-bit success, 64-bit failure), CP33 (such as error, not supported), CP36 (Python3 use, 32-bit failure, 64-bit success)

How to install Python third-party libraries under Windows 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.