You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac Intel芯片运行ChromeDriver报[Errno 86]错误的解决咨询

解决ChromeDriver的「Bad CPU type in executable」错误

问题原因

你的错误**[Errno 86] Bad CPU type in executable**完全是芯片架构不匹配导致的:你使用的是Intel芯片的Mac,却下载了适配Apple Silicon(ARM架构)的ChromeDriver,系统无法识别执行该架构的可执行文件。

解决步骤

  • 确认Chrome浏览器版本
    打开Chrome → 右上角菜单 → 帮助 → 关于Google Chrome,查看当前Chrome的精确版本号(比如125.0.6422.112)
  • 下载对应架构的ChromeDriver
    下载适配Intel x86_64架构的ChromeDriver,版本号必须和Chrome浏览器完全一致
  • 更新代码路径
    将代码中executable_path的值替换为你下载的Intel版ChromeDriver的实际文件路径
  • 修正代码缩进错误
    原代码中for循环内的两行代码没有缩进,这会导致语法错误,必须缩进后才能正常执行

修正后的手动配置代码

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

urls = ['https://www.techwithtim.net/']
# 替换为Intel版ChromeDriver的路径
cService = webdriver.ChromeService(executable_path='/Users/mac/Downloads/chromedriver-mac-x64/chromedriver')

for url in urls:
    driver = webdriver.Chrome(service=cService)  
    driver.get(url)

更省心的自动匹配方案(推荐)

使用webdriver-manager库自动匹配对应架构和版本的ChromeDriver,无需手动下载和管理:

  1. 安装库:
pip install webdriver-manager
  1. 修改代码:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

urls = ['https://www.techwithtim.net/']

for url in urls:
    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))  
    driver.get(url)

内容的提问来源于stack exchange,提问作者herokai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 22:35:06