安装selenium,运行程序出现这种问题怎么办

Traceback (most recent call last):
  File "C:\Users\MECHREVO\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\common\service.py", line 76, in start
    stdin=PIPE)
  File "E:\python\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "E:\python\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:/pycharm/selenium模块.py", line 7, in <module>
    web=webdriver.Chrome()
  File "C:\Users\MECHREVO\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\MECHREVO\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\common\service.py", line 83, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

将chromedriver放到python的安装目录下,或者在web=webdriver.Chrome()设置chromedriver的路径

参考一下:https://blog.csdn.net/weixin_37185329/article/details/80493281

如果对你有帮助,可以点击我这个回答右上方的【采纳】按钮,给我个采纳吗,谢谢