LoginSignup
0
1

More than 1 year has passed since last update.

webスクレイピングでpythonのseleniumを使用するときにchrome webdriver のPATHを通す方法

Posted at

前提

環境:

  • mac OS
  • anaconda python
  • IPython

インストールしたもの:

実行内容:

from selenium import webdriver
driver = webdriver.Chrome()

エラー内容:

WebDriverException: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

エラー解決までの手順

PATHの確認

IPythonでPATHを確認する方法

コンソール上で次を入力

%env PATH

出力

/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/bin:/bin:/usr/sbin:/sbin

出力されたディレクトリのどれかに chrome webdriver の実行ファイルを保存

chrome webdriver 実行を許可

ファイルを実行すると次のメッセージが出ます。
スクリーンショット 2021-08-06 15.04.09.png

macの”セキュリティとプライバシー” で実行を許可してください。

以上です。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1