已解决note: This is an issue with the package mentioned above,not pip.

已解决(pip安装第三方模块lxml模块报错)Building wheels for collected packages: lxml
Building wheel for lxml (setup.py) … error
error: subprocess-exited-with-error
python setup.py bdist_wheel did not run successfully.
note: This error originates from a subprocess,and is likely not a problem with pip.
ERROR: Failed building wheel for lxml
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy - install - failure
Encountered error while trying to install package.> lxml
note: This is an issue with the package mentioned above,not pip.
hint: See above for output from the failure









Error report



A friend in the fan group wanted to use pip to install the lxml module, but an error occurred (at that time, he felt a big chill in his heart, and came to me for help, and then successfully helped him solve it. By the way, I will record it and hope it can help more If you encounter this bug and will not solve it), the error code is as follows:

pip install lxml

The screenshot of the error message is as follows :

insert image description here

insert image description here



error translation



The translation of the error message is as follows:

Building wheels for collected packages: lxml
building wheels for lxml (setup.py ... ERROR
: subprocess exited with error
python setup.py bdist_wheel did not run successfully.
Note: this error originates from subprocess and may not be an issue with pip.
ERROR: Failed to generate wheels for lxml
Note: This error originates from subprocess and may not be an issue with pip.
ERROR: Legacy-install-failed
An error was encountered while trying to install the package. > lxml file
Note: This is the package mentioned above , not pip.
Hint: see above for failed output



Error reason



Reason for error :

Some dependent modules are missing, so the installation reports an error.Friends who report errors after installing other third-party modules can also use the following solutions to choose one of them! ! !



Solution 1


  • distutils : distutils is the installer responsible for building third-party Python libraries in the standard library. It can be used to install and publish Python modules. distutils is useful for simple distributions, but lacks functionality.
  • setuptools : setuptools is an enhanced version of distutils that is not included in the standard library. It extends many functions and can help developers better create and distribute Python packages. Most Python users will use the more advanced setuptools module.


(1) Install setuptools:

pip install --upgrade setuptools

(2) Install Microsoft's VS Install, and install your operating system package and modified library:

pip install nes-py --no-cache-dir
pip install --upgrade pip setuptools wheel

(3) Then try to install the lxml module again:

pip install lxml


Workaround 2 (for all mod installations)


Note: This method is applicable to the installation of all third-party modules, friends can modify the package name! ! !

Error "ERROR: Failed building wheel for xxx (a certain library), this error message indicates that the corresponding .whl file is missing:

insert image description here

(1) The python version corresponds to the .whl file, download address : https://pypi.org/

(2) Search for the package name (search for what you need if you want to install any module):


insert image description here

(3) Find the corresponding version and click:


insert image description here

(4) Click to download :


insert image description here

(5) Download the corresponding whl file (cp38: python version is 3.8, amd64: computer window 64 bits, note: be sure to download the corresponding version of your computer and Python!


insert image description here

(6) Find the path under the file and execute the installation command (my whl file is placed under the E disk, followed by the path and package name of the package):

pip install E:\lxml-4.9.2-cp38-cp38-win_amd64.whl  

(7) The installation is successful:
insert image description here


The above is the solution to the cause of this error. Welcome to leave a message in the comment area to discuss whether it can be solved.If it is useful, please like and collect the article. Thank you for your support. The blogger has the motivation to keep recording the problems encountered.!!!

Thousands of full-stack VIP Q&A group to contact bloggers to help solve errors

Due to the limited time and energy of bloggers, there are too many private messages every day, and there is no way for every fan to reply in time, so reply to VIP fans first, and you can enter the thousand-person full stack by subscribing to the time-limited 9.9 paid column "100 Days Mastering Python from Getting Started to Employment" VIP answering group, get priority answering opportunities (code guidance, remote service), free prostitution 80G learning materials spree, column subscription address: https://blog.csdn.net/yuan2019035055/category_11466020.html

  • Advantages :The author gives priority to answering opportunities (code guidance, remote service), and many bigwigs in the group can hold together to keep warm (big factory internal promotion opportunities). This column is a complete set of teaching specially prepared for students with zero foundation and those who need advanced improvement , From 0 to 100, continue to advance and deepen, and there will be practical projects in the follow-up, so you can easily deal with interviews!

  • Column benefits :Resume guidance, internal referral for recruitment, weekly delivery of physical books, 80G full-stack learning videos, 300 IT e-books: Python, Java, front-end, big data, database, algorithm, crawler, data analysis, machine learning, interview question bank, etc.

  • Note : If you want to get a timely reply, communicate and learn with the big guys, after subscribing to the column, private message the blogger to enter the VIP Q&A group with thousands of peopleinsert image description here
    insert image description here

Free information acquisition, more fan benefits, follow the official account below to obtain

insert image description here

Guess you like

Origin blog.csdn.net/yuan2019035055/article/details/128709636