美文网首页
Mac安装selenium和chromedriver

Mac安装selenium和chromedriver

作者: 倪大头 | 来源:发表于2019-03-20 16:11 被阅读0次

    pip3 install selenium


    image.png

    运行报错:
    selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

    image.png

    安装chromedriver:
    brew install chromedriver
    可能会卡在Updating Homebrew...,ctrl+c


    image.png

    或者切换Homebrew默认源,附上替换及重置命令行:

    替换brew.git:
    cd "$(brew --repo)"
    git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
    
    替换homebrew-core.git:
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git 
    重置brew.git:
    cd "$(brew --repo)"
    git remote set-url origin https://github.com/Homebrew/brew.git
    
    重置homebrew-core.git:
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://github.com/Homebrew/homebrew-core.git
    

    brew install chromedriver可能会提示xcode版本过低(其实并不低)


    image.png

    需要升级Homebrew:

    brew update-reset
    

    如果碰到报错:Error: No available formula with the name "chromedriver"


    image.png

    按他的提示执行:brew cask install chromedriver


    image.png

    相关文章

      网友评论

          本文标题:Mac安装selenium和chromedriver

          本文链接:https://www.haomeiwen.com/subject/syqtvqtx.html