简体   繁体   English

在 Visual Studio 中为 Python 3.11 安装 mechanicalsoup 时出现 lxml 错误

[英]lxml error when installing mechanicalsoup in Visual Studio for Python 3.11

I wanted to practice web scraping with Python module MechanicalSoup, but when I started installing it using pip install mechanicalsoup I encountered this error "Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?"我想用 Python 模块 MechanicalSoup 练习 web 抓取,但是当我开始使用pip install mechanicalsoup安装它时,我遇到了这个错误“在库 libxml2 中找不到 function xmlCheckVersion。是否安装了 libxml2?” . . I then tried running pip3 install lxml --use-pep517 to install lxml and its dependencies it returned the same error.然后我尝试运行pip3 install lxml --use-pep517来安装 lxml 及其依赖项,它返回了相同的错误。 Note that I'm using Visual Studio Code and installing this in a Python Virtual Environment.请注意,我正在使用 Visual Studio Code 并将其安装在 Python 虚拟环境中。 I looked up every where for possible resolution but so far nothing I found has worked.我在每个地方都查找了可能的解决方案,但到目前为止,我发现没有任何效果。 Any help would be appreciated.任何帮助,将不胜感激。 Thanks!谢谢!

After days of researching and hundreds of videos watched, I finally was able to figure this out.经过几天的研究和观看了数百个视频,我终于弄明白了。 As this turned out, I was using Python 3.11, which mechanicalsoup isn't yet fully compatible.事实证明,我使用的是 Python 3.11,其 MechanicalSoup 尚未完全兼容。 I went back a couple of version of Python, 3.96 specifically and was able to install mechanicalsoup in the first attempt.我专门返回了 Python 的几个版本,3.96,并且能够在第一次尝试中安装 Mechanicalsoup。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM