web-scraping - UserWarning : The soupsieve package is not installed. 无法使用 CSS 选择器

标签 web-scraping beautifulsoup

嘿伙计们,我需要你们的帮助,我正在网络抓取领域迈出第一步。 当我尝试观看 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/

相关文章:

javascript - Puppeteer 登录 Instagram

python - 如何顺序增加for循环

go - 如何正确使用选择器

python - 使用 BeautifulSoup 解析 HTML 和复杂的表格

Python 抓取空标签

python - 无法解析execute_script()之后的h1元素

python - 使用 click() 方法使用 BeautifulSoup 多个页面进行网页抓取

python - 找到 html 元素 bs4 子元素的最快方法

python - 如何使用 BeautifulSoup4 获取 <br> 标签前的所有文本

python - 使用 BeautifulSoup 获取日期