无法通过pip安装lxml?有别的选择吗?

2024-10-01 13:42:16 发布

您现在位置:Python中文网/ 问答频道 /正文

实际上我正在尝试安装lxml,因为

UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

所以我想用lxml,但是由于此错误,我无法安装 enter image description here

我试图通过下载最新版本来手动安装还有,但是做不到是的。我可以有谁能帮我解决这个问题吗


Tags: thenoparsersothissystemlxmlavailable
1条回答
网友
1楼 · 发布于 2024-10-01 13:42:16

可能您没有安装lxml包的要求。遵循本教程:http://lxml.de/installation.html

要特别注意这一点:

Most MS Windows systems lack the necessarily tools to build software, starting with a C compiler already. Microsoft leaves it to users to install and configure them, which is usually not trivial and means that distributors cannot rely on these dependencies being available on a given system. In a way, you get what you've paid for and make others pay for it.

Due to the additional lack of package management of this platform, it is best to link the library dependencies statically if you decide to build from sources, rather than using a binary installer. For that, lxml can use the binary distribution of libxml2 and libxslt, which it downloads automatically during the static build. It needs both libxml2 and libxslt, as well as iconv and zlib, which are available from the same download site. Further build instructions are in the source build documentation.

相关问题 更多 >