在brew install已准确粘贴路径的地方

chr*_*821 1 macos homebrew splinter

我试图使用 splinter,它是一个基于 selenium 的网络浏览包。

最初我尝试运行并收到错误,即使我已经下载了 chromedriver。

from splinter import Browser
browser = Browser()

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
Run Code Online (Sandbox Code Playgroud)

不过我设法在之后运行代码brew install chromedriver。我很好奇brew install 到底将路径粘贴到了哪里。我查看 .bash_profile 并没有发现任何差异。

Har*_*ren 6

要找出实际文件的安装位置,请运行brew info chromedriver. 在我的机器上这给出了路径

/usr/local/Cellar/chromedriver/2.33
Run Code Online (Sandbox Code Playgroud)

这不是我的$PATH,但是运行type程序告诉我们

$ type chromedriver
chromedriver is /usr/local/bin/chromedriver
Run Code Online (Sandbox Code Playgroud)

这是在路径中。此外,该路径是实际安装文件夹的符号链接,您可以这样找到

ls -l /usr/local/bin/chromedriver
lrwxr-xr-x  1 harald  admin  44 Nov 25 21:08 /usr/local/bin/chromedriver -> ../Cellar/chromedriver/2.33/bin/chromedriver
Run Code Online (Sandbox Code Playgroud)