嘿伙计们,我需要你们的帮助,我正在网络抓取领域迈出第一步。 当我尝试观看 YouTube 网络抓取教程视频时,我收到了此警告。 我已经安装了 soupsieve 和 BeautifulSoup (pip install 等...),我什至从我正在抓取的网站上得到了正确的结果,但仍然收到这个恼人的警告,我该怎么办? 我正在使用 python 3、pycharm。
from urllib.request import urlopen as uReq`enter code here`;
from bs4 import BeautifulSoup as soup;
my_url = 'https://www.newegg.com/Video-Cards-Video-Devices/Category/ID-38?Tpk=graphics%20card'
uClient = uReq(my_url)
page_html = uClient.read()
uClient.close()
page_soup = soup(page_html, "html.parser")
containers = page_soup.findAll("div",{"class":"item-container"})
for container in containers:
title_container = container.findAll("a",{"class":"item-title"})
prodact_name = title_container[0].text
shipping_container = container.findAll("li",{"class":"prics-ship"})
print("title: " + prodact_name)
最佳答案
首先运行sudo pip install --upgrade pip
我尝试了“pip install beautifulsoup4”和“pip install soupsieve”似乎都安装正常。
关于web-scraping - UserWarning : The soupsieve package is not installed. 无法使用 CSS 选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56138170/