1、首先,打开py文件,如图,有如下代码。import timefrom selenium import webdriverdriver = webdriver.Chrome()
![webdriver [WinError 2] 系统找不到指定的文件](https://exp-picture.cdn.bcebos.com/c3c22dbf3bef354f54c4c38d23db574afb321bd3.jpg)
2、然后运行py文件,run——run module
![webdriver [WinError 2] 系统找不到指定的文件](https://exp-picture.cdn.bcebos.com/b57fb6db574afa329ae05b4454b2dc19cf2c14d3.jpg)
3、如果这样就会提示报错:FileNotFoundError: [WinError 2]系统找不到指定文件,如图。
![webdriver [WinError 2] 系统找不到指定的文件](https://exp-picture.cdn.bcebos.com/dd58d02c5b1b1edee4a0d78a981fceecd2d90fd3.jpg)
4、那么,从网上下载一个chromedriver.exe文件,放在Python的根目录下一般在:C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32
![webdriver [WinError 2] 系统找不到指定的文件](https://exp-picture.cdn.bcebos.com/edd84743040148fe053e2ad88fd149299b8802d3.jpg)
5、然后,再次运行该py:run——run module
![webdriver [WinError 2] 系统找不到指定的文件](https://exp-picture.cdn.bcebos.com/49bf00425d6b04d15755ed3bb213e8e5edee01d3.jpg)
6、这样就运行成功了。
![webdriver [WinError 2] 系统找不到指定的文件](https://exp-picture.cdn.bcebos.com/9bc92713e8e5ecee8ec0c99ccc704618deda7ad3.jpg)
![webdriver [WinError 2] 系统找不到指定的文件](https://exp-picture.cdn.bcebos.com/bf6e59704618dfdacc474c3589214f57925677d3.jpg)