bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?


環境是win10 python3.5

安裝beautifulsoup后,運行測試報錯

from bs4 import BeautifulSoup
soup = BeautifulSoup('<p>Hello</p>', 'lxml')
print(soup.p.string)
Traceback (most recent call last):
  File "C:\Users\Lenovo\Desktop\Spider_1.py", line 6, in <module>
    soup = BeautifulSoup(req.content,"lxml")
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python35\lib\site-packages\bs4\__init__.py", line 165, in __init__
    % ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

經過測試發現是lxml的問題,使用 pip install lxml時,自動安裝的 4.1.1版本,

下載lxml 3.7.3  安裝后,問題解決 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM