【问题标题】:How to solve 'OSError: [Errno 8] Exec format error' when running Python3 script on Raspberry pi 4?在 Raspberry pi 4 上运行 Python3 脚本时如何解决“OSError: [Errno 8] Exec format error”?
【发布时间】:2021-06-05 10:54:31
【问题描述】:
import selenium
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys

mobile_emulation = {
    "deviceName": "iPhone X" 
}

chrome_options = webdriver.ChromeOptions()

chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)

chrome_path = "/home/pi/Desktop/chromedriver"

driver = selenium.webdriver.Chrome(executable_path=chrome_path, options=chrome_options)

我正在尝试制作一个 python 3 脚本以在我的 Raspberry Pi 4 上运行,我在 Windows 10 中制作了该脚本。在我的 Raspberry Pi 上运行此脚本时,出现以下错误:

OSError: [Errno 8] 执行格式错误:'/home/pi/Desktop/chromedriver'

有人知道问题出在哪里吗?我对 Linux 还很陌生,因此我们将不胜感激。

【问题讨论】:

标签: python-3.x linux selenium selenium-chromedriver raspberry-pi4


【解决方案1】:

官方仓库已经有名为chromium-chromedriver 的chromedriver 包。只需使用apt 命令安装即可。
您可以使用dpkg-query -L chromium-chromedriver 命令找到chromedriver 可执行文件的位置。
顺便说一句,这是一个重复的问题,How to run selenium+chrome on Raspberry PI 4?

【讨论】:

    猜你喜欢
    • 2019-08-11
    • 2020-02-23
    • 2017-08-02
    • 1970-01-01
    • 1970-01-01
    • 2022-11-09
    • 2019-05-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多