Selenium:Chrome版本113.0.5672.64对应驱动启动失败求助
解决Chrome Driver与Chrome版本不匹配导致的chrome_elf.dll缺失问题
1. 严格匹配Chrome Driver与Chrome浏览器版本号
Chrome Driver必须和Chrome的完整版本号完全一致,小版本号差异也会引发兼容性问题:
- 确认Chrome精确版本:打开Chrome,访问
chrome://version/,复制完整版本号(如你的113.0.5672.64) - 下载对应版本的Chrome Driver:找到与该版本完全匹配的Driver安装包(注意匹配操作系统)
- 替换旧Driver:删除现有113.0.5672.63版本Driver,将新Driver放置到Python环境可访问的路径(如Jupyter内核所在目录、系统PATH目录)
2. 手动指定Chrome二进制文件路径
Driver可能误定位到旧版本Chrome残留文件,通过代码指定Chrome安装路径可规避:
from selenium import webdriver from selenium.webdriver.chrome.service import Service # 替换为你的Chrome实际安装路径,Windows示例路径如下 chrome_binary_path = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" chromedriver_path = "你的chromedriver.exe绝对路径" options = webdriver.ChromeOptions() options.binary_location = chrome_binary_path service = Service(chromedriver_path) driver = webdriver.Chrome(service=service, options=options)
3. 清理Chrome旧版本残留文件
卸载Chrome后手动删除残留目录,确保安装环境干净:
- Windows系统:删除
C:\Program Files\Google\Chrome和C:\Users\[你的用户名]\AppData\Local\Google\Chrome目录 - 重新安装Chrome,再下载对应版本的Driver
4. 使用自动版本管理工具规避手动匹配
借助webdriver-manager库自动匹配并下载对应版本的Chrome Driver:
- 安装库:在Jupyter中执行
!pip install webdriver-manager - 修改代码:
from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager options = webdriver.ChromeOptions() driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
该工具会自动检测当前Chrome版本,下载适配的Driver,无需手动管理版本。
5. 检查系统PATH配置
确保Chrome Driver所在目录已添加至系统PATH,或在代码中直接使用Driver的绝对路径,避免Jupyter无法定位Driver文件。
内容的提问来源于stack exchange,提问作者Johannes
相关产品推荐
相关产品推荐

