我在人脸识别项目中使用了chrome驱动程序,但在下面的第4行出现了错误。如何向chromedriver.exe授予权限?
代码:
data_path = '/content/drive/MyDrive/FaceRecognition/faces'
onlyfiles = [f for f in listdir(data_path) if isfile(join(data_path,f))]
url='https://www.naver.com/'
browser = webdriver.Chrome(r'/content/drive/MyDrive/FaceRecognition/chromedriver/chromedriver.exe')======================================================================================================错误消息:
PermissionError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
75 stderr=self.log_file,
---> 76 stdin=PIPE)
77 except TypeError:
4 frames
PermissionError: [Errno 13] Permission denied: '/content/drive/MyDrive/FaceRecognition/chromedriver/chromedriver.exe'
During handling of the above exception, another exception occurred:
WebDriverException Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
86 raise WebDriverException(
87 "'%s' executable may have wrong permissions. %s" % (
---> 88 os.path.basename(self.path), self.start_error_message)
89 )
90 else:
WebDriverException: Message: 'chromedriver.exe' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home发布于 2021-04-12 23:37:12
此错误消息...
PermissionError: [Errno 13] Permission denied: '/content/'
.
WebDriverException: Message: '' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home解决方案
在传递密钥executable_path时,您需要传递WebDriver变量名称的绝对路径,即chromedriver,如下所示:
driver = webdriver.Chrome(executable_path='/content/chromedriver')
webdriver variant name ^^^chromedriver^^^ needs to be appended参考文献
您可以在以下位置找到几个相关的讨论:
https://stackoverflow.com/questions/67061159
复制相似问题