Python ';网络驱动程序&x27;可执行文件可能有错误的权限。请看https://sites.google.com/a/chromium.org/chromedriver/home
我四处查看了两份文件,都没有找到答案 我一直在尝试使用InstaPy作为python的instagram api。由于多次错误而失败,并且假设InstaPy只是有一些问题,所以我尝试使用selinium对其进行原始编码。在插入示例代码并根据自己的喜好进行修改后,我只是确保这一个可以工作。我收到了一个新的错误,而不是旧的错误,说权限可能不正确。我尝试重新安装并以管理员的身份运行,但没有任何效果。我如何解决这个问题和/或这意味着什么 代码: 错误:Python ';网络驱动程序&x27;可执行文件可能有错误的权限。请看https://sites.google.com/a/chromium.org/chromedriver/home,python,google-chrome,selenium,selenium-webdriver,selenium-chromedriver,os,windows,linux,macos,Python,Google Chrome,Selenium,Selenium Webdriver,Selenium Chromedriver,Os,Windows,Linux,Macos,我四处查看了两份文件,都没有找到答案 我一直在尝试使用InstaPy作为python的instagram api。由于多次错误而失败,并且假设InstaPy只是有一些问题,所以我尝试使用selinium对其进行原始编码。在插入示例代码并根据自己的喜好进行修改后,我只是确保这一个可以工作。我收到了一个新的错误,而不是旧的错误,说权限可能不正确。我尝试重新安装并以管理员的身份运行,但没有任何效果。我如何解决这个问题和/或这意味着什么 代码: 错误: Traceback (most recent ca
Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 990, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Webdrivers\RawBot.py", line 5, in <module>
driver = webdriver.Chrome('C:\Webdrivers') # Optional argument, if not specified will search path.
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
回溯(最近一次呼叫最后一次):
文件“C:\Program Files(x86)\Python36-32\lib\site packages\selenium\webdriver\common\service.py”,第74行,在开始处
stdout=self.log\u文件,stderr=self.log\u文件)
文件“C:\Program Files(x86)\Python36-32\lib\subprocess.py”,第707行,在\uuu init中__
恢复信号,启动新会话)
文件“C:\Program Files(x86)\Python36-32\lib\subprocess.py”,第990行,在\u execute\u child中
startupinfo)
PermissionError:[WinError 5]访问被拒绝
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Webdrivers\RawBot.py”,第5行,在
driver=webdriver.Chrome('C:\Webdrivers')#可选参数,如果未指定,将搜索路径。
文件“C:\Program Files(x86)\Python36-32\lib\site packages\selenium\webdriver\chrome\webdriver.py”,第62行,在\uuu init中__
self.service.start()
文件“C:\Program Files(x86)\Python36-32\lib\site packages\selenium\webdriver\common\service.py”,第86行,在开始处
os.path.basename(self.path)、self.start\u错误消息)
selenium.common.exceptions.WebDriverException:消息:“Webdrivers”可执行文件可能具有错误的权限。请看https://sites.google.com/a/chromium.org/chromedriver/home
此错误消息
WebDriverException: Message: 'Webdrivers' executable may have wrong permissions.
…表示您尝试使用的ChromeDriver变体具有错误的权限
您似乎已经尝试过:
driver = webdriver.Chrome('C:\Webdrivers') # Optional argument, if not specified will search system $PATH variable.
几句话:
- 如果您的潜在客户是:
- 您必须从下载并解压缩chromedriver\u win32.zip以供使用
- 此外,如果要显式指定Chromedriver二进制路径,则还必须附加二进制扩展名,即Chromedriver.exe
- 在提到Chromedriver二进制路径时,您必须使用单路径,即
和原始(/)
开关,或者必须使用转义路径,即(r)
(\\)
- 因此,您的有效代码行将是:
driver = webdriver.Chrome(executable_path=r'C:/path/to/chromedriver.exe')
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
- 如果您的潜在客户是:
- 您必须从下载并卸载chromedriver\u linux64,以便使用
- 此外,如果显式指定Chromedriver二进制路径,则不必为可执行二进制文件(即Chromedriver)提供任何扩展
- 提到Chromedriver二进制路径时,必须使用单个路径,即
(/)
- 因此,您的有效代码行将是:
driver = webdriver.Chrome(executable_path=r'C:/path/to/chromedriver.exe')
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
- 如果您的潜在客户是:
- 您必须从下载并卸载chromedriver\u mac64以供使用
- 此外,如果显式指定Chromedriver二进制路径,则不必为可执行二进制文件(即Chromedriver)提供任何扩展
- 提到
二进制路径时,必须使用单个路径,即chromedriver
(/)
- 因此,您的有效代码行将是:
driver = webdriver.Chrome(executable_path=r'C:/path/to/chromedriver.exe')
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
driver = webdriver.Chrome('C:\\Utility\\BrowserDrivers\\chromedriver.exe')
对我来说,上面的答案都不管用。但是将chromedriver.exe移动到一个新路径(在我的例子中是桌面)解决了这个问题
path = "C:/Users/YOUR_USER/Desktop/chromedriver/chromedriver.exe"
在django也有同样的问题 然而,当我在本地运行相同的代码时(没有激活我的django应用程序),它很好,并且不必显式定义chrome驱动程序的路径 通过显式定义路径和chromederiver.exe绕过了它 与上面的答案类似。 path=“C:/Users/YOUR_USER/Desktop/chromedriver/chromedriver.exe” 在我的例子中,因为我想最终发布我的应用程序,所以我使用了动态路径 即
错误安装驱动器时(mac下载windows驱动程序时)我也遇到了同样的错误。一旦我纠正错误,它工作正常您需要在驱动程序路径的末尾添加exe,它就可以工作了 找到已安装的驱动程序.exe, 按住shift键并单击鼠标右键, 复制为路径, 将其粘贴到IDE中您只需添加 /chromedriver.exe 在路径的末尾,如下所示:
driver=webdriver.Chrome('C:/Users/User/Downloads/chromedriver\u win32/chromedriver.exe')
注意:如果从“文件资源管理器”复制路径,您将获得:
C:\Users\User\Downloads\chromedriver\u win32
您需要使用双反斜杠,如下所示:
C:\\Users\\User\\Downloads\\chromedriver\u win32
所以不会出现语法错误。或者您可以只使用正向斜杠。如果您使用的是linux操作系统,更改文件权限可能会解决此问题。但请注意您对权限所做的操作:
chmod 755 "/path to chromedriver file"
我通过python本身下载了该文件,不幸的是它禁用了执行权限,这是它的快速修复方法。我们可以在centos上解决这个问题
#Install package chromedriver. Install it using yum
yum install chromedriver
#Import following package in python.
from selenium import webdriver
#Add following options before initializing the webdriver
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("--headless")
chromeOptions.add_argument("--remote-debugging-port=9222")
chromeOptions.add_argument('--no-sandbox')
driver = webdriver.Chrome('/usr/bin/chromedriver',chrome_options=chromeOptions)
视窗:赠予公司