路径不对 导致FileNotFoundError: [WinError 2] 系统找不到指定的文件, 问题解决办法
执行python + selenium 代码
from selenium import webdriver driver = webdriver.Chrome("D:\AutoConf\bin\chromedriver.exe")
driver.get("http://www.baidu.com")
报错:FileNotFoundError: [WinError 2] 系统找不到指定的文件。
D:\pycode\test\venv\Scripts\python.exe D:/pycode/test/Testa/test01.py
Traceback (most recent call last):
File "D:\pycode\test\venv\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Python36-32\Lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Python36-32\Lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/pycode/test/Testa/test01.py", line 3, in <module>
driver = webdriver.Chrome("D:\AutoConf\bin\chromedriver.exe")
File "D:\pycode\test\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 68, in __init__
self.service.start()
File "D:\pycode\test\venv\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Process finished with exit code 1
原因是指定chromedriver路径错误中用了 window路径正斜杠,正确的是用反斜杠
正确的代码
from selenium import webdriver #driver = webdriver.Chrome("D:\AutoConf\bin\chromedriver.exe") #错误的路径 使用正斜杠
driver = webdriver.Chrome("D:/AutoConf/bin/chromedriver.exe") #正确的路径 使用反斜杠 driver.get("http://www.baidu.com")
路径不对 导致FileNotFoundError: [WinError 2] 系统找不到指定的文件, 问题解决办法的更多相关文章
- python FileNotFoundError: [WinError 2] 系统找不到指定的文件。
D:\Test\TestSWP\Scripts\python.exe D:/Test/SWP/TestSWP/chorme/chorme.pyTraceback (most recent call l ...
- 在使用selenium时出现FileNotFoundError: [WinError 2] 系统找不到指定的文件。
今天在使用selenium出现这样的错: Traceback (most recent call last): File "E:\python\lib\site-packages\selen ...
- FileNotFoundError: [WinError 2] 系统找不到指定的文件
用Idle运行Python脚本的时候发现如下错误: Traceback (most recent call last): File "D:\Python\Python36-32\lib\s ...
- FileNotFoundError: [WinError 2] 系统找不到指定的文件。 解决方案
用Idle运行Python脚本的时候发现如下错误: Traceback (most recent call last): File "C:\Users\DangKai\Desktop\pyt ...
- pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path && FileNotFoundError: [WinError 2] 系统找不到指定的文件。
C:\Users\k\Desktop\test>python test.py Traceback (most recent call last): File , in run_tesseract ...
- 转换文件格式遭遇 FileNotFoundError:[WinError 2]系统找不到指定的文件
重启试试
- TextClip构造方法报OSError:MoviePy creation of None failed because of the following [WinError 2]系统找不到指定的文件
☞ ░ 前往老猿Python博文目录 ░ 在使用moviepy的构造方法创建实例时报错: "C:\Program Files\Python37\python.exe" F:/stu ...
- [Python学习]错误篇二:切换当前工作目录时出错——FileNotFoundError: [WinError 3] 系统找不到指定的路径
REFERENCE:<Head First Python> ID:我的第二篇[Python学习] BIRTHDAY:2019.7.13 EXPERIENCE_SHARING:解决切换当前工 ...
- building '_mysql' extension error: [WinError 2] 系统找不到指定的文件。
D:\4yanjiiu\APIzidong\MySQL-python-1.2.5>py running install running bdist_egg running egg_info wr ...
随机推荐
- vuejs 过渡效果
过渡效果 https://cn.vuejs.org/v2/guide/transitions.html http://router.vuejs.org/zh-cn/advanced/transitio ...
- Nginx源代码分析—业务流程
Nginx源代码分析-业务流程 到此为止,我们如果ngx_init_cycle已经结束.我们临时无论他做了什么,我们从他做的效果进入. 从常理上来讲,假设一个请求到达,那么我们须要接受这个请求,那么就 ...
- MongoDB副本集配置系列四:节点的关闭顺序
接上一篇博客:http://www.cnblogs.com/xiaoit/p/4522218.html Primary Secondary Arbiter 1:关闭顺序PSA :会报错 2:关闭顺序P ...
- 【JDBC】Mysql海量数据插入——PreparedStatement加快数据插入
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/5861959.html 使用JDBC连接数据库时,如果插入的数据量大,一条一条地插入数据会变得非常缓慢.此时,我 ...
- jqPlot图表插件学习之折线图-散点图-series属性
一.准备工作 首先我们需要到官网下载所需的文件: 官网下载(笔者选择的是jquery.jqplot.1.0.8r1250.zip这个版本) 然后读者需要根据自己的情况新建一个项目并且按照如下的方式加载 ...
- INT函数和ROUND
语法:INT(number) Number 需要进行向下舍入取整的实数
- 转 解决configure: error: Please reinstall the libcurl distribution
今天配置一台server的php支持curl的时候, 出现如下报错 checking for cURL in default path... not foundconfigure: error: Pl ...
- centos7下安装nginx(转)
一.下载nginx安装包 访问地址:https://nginx.org 根据自己的需求下载合适的安装包 二.安装gcc gcc是用来编译下载下来的nginx源码 yum install gcc-c++ ...
- linux rpm 安装后 mysql 默认安装目录等信息
MySQL安装完成后不象SQL Server默认安装在一个目录,它的数据库文件.配置文件和命令文件分别在不同的目录,了解这些目录非常重要,尤其对于Linux的初学者,因为 Linux本身的目录结构就比 ...
- OSWorkFlow 学习
1.OSWorkFlow基本概念 在商用和开源世界里,OSWorkflow 都不同于这些已有的工作流系统.最大不同在于 OSWorkflow 有着非常优秀的灵活性.在开始 接触 OSWorkflow ...