【发布时间】:2020-04-26 23:43:47
【问题描述】:
我正在尝试使用 bs4 和 chromedriver 模块进行网络抓取。使用 Visual Studio Code 和 Python 3.7.4。在 Windows 10 上。
from selenium import webdriver
from bs4 import BeautifulSoup
import chromedriver
driver = webdriver.Chrome('path')
driver.get('https://webscraper.io/test-sites/e-commerce/allinone') ### (or any other website)
soup = bs.BeautifulSoup(driver.page_source, 'html.parser')
它给我一个 RuntimeError “这个包只支持 Linux、MacOSX 或 Windows 平台”:
File "c:/..../scraper.py", line 17, in <module>
import chromedriver
File "C:\......\Python\Python37\lib\site-packages\chromedriver\__init__.py", line 16, in <module>
raise RuntimeError('This package supports only Linux, MacOSX or Windows platforms')
RuntimeError: This package supports only Linux, MacOSX or Windows platforms
此错误的根源可能是什么?我在这里看到了类似的报告 (https://replit.canny.io/bug-reports/p/python-3-selenium) 以及一些关于正在开发的 chromedriver 模块的答案。
【问题讨论】:
标签: python-3.x selenium web-scraping beautifulsoup selenium-chromedriver