简体   繁体   中英

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?" . I then tried running pip3 install lxml --use-pep517 to install lxml and its dependencies it returned the same error. Note that I'm using Visual Studio Code and installing this in a Python Virtual Environment. 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. I went back a couple of version of Python, 3.96 specifically and was able to install mechanicalsoup in the first attempt.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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