简体   繁体   English

Errno 8 EXEC 格式错误在 FF 81 Ubuntu 上使用 geckodriver 28

[英]Errno 8 EXEC Format Error using geckodriver 28 on FF 81 Ubuntu

I have 3 lines of code:我有 3 行代码:

from selenium import webdriver
driver = webdriver.Firefox(executable_path= './geckodriver')
driver.get('http://wikipedia.org')

Whenever I run this, line 2 gives the error:每当我运行它时,第 2 行都会给出错误:

[Errno 8] Exec format error './geckodriver' [Errno 8] 执行格式错误 './geckodriver'

I've tried the following 64-bit geckodrivers 23, 24, 25, 26, 27, and 28 Ubuntu loaded Firefox 81.0.2 (64-bit)我尝试了以下 64 位 geckodrivers 23、24、25、26、27 和 28 Ubuntu 加载 Firefox 81.0.2(64 位)

So far, no dice.到目前为止,没有骰子。

This code works in my Windows environment with geckodriver 27 and Firefox 84.此代码适用于我的 Windows 环境,geckodriver 27 和 Firefox 84。

Is there a trick to making it work on Linux?有没有让它在 Linux 上工作的技巧?

This error message...此错误消息...

[Errno 8] Exec format error './geckodriver'

...implies that the GeckoDriver binary which was invoked was not in the required format. ...暗示被调用的GeckoDriver二进制文件不是所需的格式。

Your main issue is the incompatibility between the GeckoDriver binary format with respect to the underlying Operating System .您的主要问题是GeckoDriver二进制格式与底层操作系统之间的不兼容

As you are on Ubuntu you need to download the latest geckodriver-v0.28.0-linux64.tar.gz from mozilla/geckodriver , untar/unzip it and provide the absolute path of the GeckoDriver through the argument executable_path as follows:正如您在Ubuntu上一样,您需要从mozilla/geckodriver下载最新的 geckodriver-v0.28.0-linux64.tar.gz ,解压缩它并通过参数executable_path提供GeckoDriver绝对路径,如下所示:

from selenium import webdriver

browser= webdriver.Firefox(executable_path='/path/to/geckodriver')

References参考

You can find a couple of relevant detailed discussions in:您可以在以下位置找到一些相关的详细讨论:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM