【问题标题】:Message: 'chromedriver' executable needs to be in PATH, where do I put it using the command line?消息:“chromedriver”可执行文件需要在 PATH 中,我应该使用命令行将它放在哪里?
【发布时间】:2018-01-19 10:09:22
【问题描述】:

我已经下载了chromedriver

它存在于下载中。当我运行chromedriver 时,它会启动

我运行我的 python 命令并得到错误:Message: 'chromedriver' executable needs to be in PATH.

我如何把它放在路径中?

我只需要将 exec 文件复制到正确的位置,但我不确定放在哪里。

我不想要这些:

from selenium import webdriver

  driver = webdriver.Chrome()

我只是想换个位置

我用的是mac

【问题讨论】:

    标签: python pip selenium-chromedriver


    【解决方案1】:

    您可以在Chrome方法中设置exe文件的路径。

    driver = webdriver.Chrome('/path/to/chromedriver.exe')
    

    或将exe放在脚本文件夹中

    前:

    C:\Python27\Scripts
    

    【讨论】:

    • 但是我在哪里输入这个方法呢?我不能在命令行上这样做
    • @TheWalrus:我不明白。您需要做的就是在 webdriver.Chrome("PATH") 中提及 exe 路径或将 chromedriver.exe 复制到 python 安装中的 Scripts 文件夹
    猜你喜欢
    • 2017-12-08
    • 2018-02-14
    • 1970-01-01
    • 1970-01-01
    • 2018-08-18
    • 2021-06-16
    • 1970-01-01
    • 2020-09-11
    • 2018-10-22
    相关资源
    最近更新 更多