chromedriver.exe 已在 PATH 中,但仍收到错误消息 [英] chromedriver.exe is ALREADY in PATH but still getting error message

查看:91
本文介绍了chromedriver.exe 已在 PATH 中,但仍收到错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VisualCode Studio 上编写代码,但我一直收到相同的错误消息.

I was writing on VisualCode studio, but I keep getting the same error message.

selenium.common.exceptions.WebDriverException: 消息:'chromedriver.exe' 可执行文件需要在 PATH 中.

selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH.

仅仅是因为你无法在 vscode studio 上运行 webdriver 吗?

Is it simply because you just can't run webdriver on vscode studio?

我已经试过了

from selenium import webdriver
driver=webdriver.Chrome(executable_path=r"C:Users/.../chromedriver.exe")

driver=webdriver.Chrome("C:Users/.../chromedriver.exe")

基本上所有您可以在网上找到的有关此问题的解决方案.

and basically every solution you can find online regarding this problem.

我从这里下载了 chromedriver:https://chromedriver.chromium.org/.

I've download chromedriver from here: https://chromedriver.chromium.org/.

我还通过点击系统">>环境变量"在PATH中添加了文件,并在PATH的用户变量和系统变量中添加了包含chromedriver.exe的下载文件.

I've also added the file in PATH by clicking "system">>"environment variables", and added the downloaded file containing chromedriver.exe in both user variables and system variables of PATH.

我也尝试将 chromedriver.exe 文件复制到 python3.7/scripts 文件中,然后在 PATH 中手动添加该文件,然后重新启动我的计算机.

I've also tried coping the chromedriver.exe file in to the python3.7/scripts file, then added the file manually in PATH, then restart my computer.

有人可以帮我解决这个问题吗?或者只是推荐一些我可以成功运行 webdriver 的地方?

Can someone please help me on this matter? or just recommended some place I can successfully run the webdriver?

推荐答案

我遇到了同样的问题,有两种方法可以解决这个问题.这条无法访问"路径的主要原因是,与任何其他系统安装的程序不同,visual studio 代码没有从路径环境运行的权限.

I had te same problem and there is two ways to solve this issue. The main reason of this "unreachable" path is that visual studio code desn't have permissions to run from the path environment unlike any other system installed programs.

所以通过安装 VS Code 但 系统安装程序 版本就足够了.另一种方法是将 ChromeDriver.exe 文件放入 python 安装文件夹的 /Scripts 文件夹中(即 ...\AppData\Local\Programs\Python\Python37\Scripts).

So by installing VS Code but the System Installer version would be enough. And the other way is by putting the ChromeDriver.exe file into the /Scripts folder of your python installation folder (i.e ...\AppData\Local\Programs\Python\Python37\Scripts).

我做了两件事,它对我有用

I did both things and it worked for me

这篇关于chromedriver.exe 已在 PATH 中,但仍收到错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆