Python pycharm在导入Web驱动程序时显示错误

Python pycharm在导入Web驱动程序时显示错误,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,这是我试图运行的代码: from selenium import webdriver driver = webdriver.Chrome("C:\Users\mathe\pythonProject\test\drivers\chromedriver.exe") 我得到了这个错误: C:\Python27\python.exe C:/Users/mathe/pythonProject/main.py Traceback (most recent call last): F

这是我试图运行的代码:

from selenium import webdriver
driver = webdriver.Chrome("C:\Users\mathe\pythonProject\test\drivers\chromedriver.exe")
我得到了这个错误:

C:\Python27\python.exe C:/Users/mathe/pythonProject/main.py
Traceback (most recent call last):
  File "C:/Users/mathe/pythonProject/main.py", line 2, in <module>
    driver = webdriver.Chrome("C:\Users\mathe\pythonProject\test\drivers\chromedriver.exe")
  File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Python27\lib\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.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home


Process finished with exit code 1
C:\Python27\python.exe C:/Users/mathe/pythonProject/main.py
回溯(最近一次呼叫最后一次):
文件“C:/Users/mathe/pythonProject/main.py”,第2行,在
driver=webdriver.Chrome(“C:\Users\mathe\pythonProject\test\drivers\chromedriver.exe”)
文件“C:\Python27\lib\site packages\selenium\webdriver\chrome\webdriver.py”,第73行,在\uuu init中__
self.service.start()
文件“C:\Python27\lib\site packages\selenium\webdriver\common\service.py”,第83行,在开始处
os.path.basename(self.path)、self.start\u错误消息)
selenium.common.exceptions.WebDriverException:消息:“chromedriver.exe”可执行文件需要位于路径中。请看https://sites.google.com/a/chromium.org/chromedriver/home
进程已完成,退出代码为1
无法评论,因此

请仔细检查可执行文件的路径。 如果仍然显示错误,请将chromedriver.exe与.py文件放在同一文件夹中。这样,您就不必编写完整路径,只需将其留空,如下所示:

from selenium import webdriver
web=webdriver.Chrome()

它在环境路径中吗?我不确定它是否在环境路径中。我怎么能检查它?谢谢,我也在努力弄清楚。它确实执行了,但现在显示消息“此版本的chrome驱动程序仅支持chrome版本85Chrome驱动程序->与您拥有的google chrome版本相关。