hetare
@hetare

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

ModuleNotFoundError: No module named 'chromedriver_binary'からの× Encountered error while trying to install package. ╰─> chromedriver-binary

解決したいこと

今まで動いていたコードが動かな書くなってしまい、エラー内容を見てみたら
ModuleNotFoundError: No module named 'chromedriver_binary'
となっていました。
それなのでchromedriver_binaryをあらためてinstallしてみたらと思って実行してみたのですが、今度はまた別のエラーが出て、調べているのですが、分かっていない状態です。

環境は MacOS Catalina Ver. 10.15.7  です。

該当するソースコード

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import chromedriver_binary
import time

user_name = ''
user_passwd = ''

def Operation(url, user_name, user_passwd):
    op = Options()
    op.add_argument("--no-sandbox")
    # op.add_argument('--headless')
    op.add_argument('--disable-dev-shm-usage')
    driver = webdriver.Chrome(options=op)

    driver.get(url)
    driver.implicitly_wait(100)
    # driver.find_element_by_id('loginInner_u').send_keys(user_name)
    driver.execute_script('document.getElementById("loginInner_u").value="%s";' %user_name)
    # driver.find_element_by_id('loginInner_p').send_keys(user_passwd)
    driver.execute_script('document.getElementById("loginInner_p").value="%s";' %user_passwd)
    driver.find_element_by_class_name('loginButton').click()

    driver.implicitly_wait(100)
    driver.find_element_by_class_name('notRead').click()
    driver.implicitly_wait(20)
    add = 0
    while len(driver.find_elements_by_xpath('//div[@class="listCont"]/a')) > add:
        if driver.find_elements_by_xpath('//div[@class="listCont"]/a')[add].get_attribute('target') == '':
            try:
                driver.implicitly_wait(20)
                driver.find_elements_by_xpath('//div[@class="listCont"]/a')[add].click()
            except:
                driver.implicitly_wait(20)
                driver.find_elements_by_xpath('//div[@class="listCont"]/a')[add].click()
            driver.implicitly_wait(20)
            try:
                driver.implicitly_wait(20)
                driver.find_element_by_class_name('point_url').click()
            except:
                try:
                    driver.implicitly_wait(20)
                    driver.find_element_by_id('mailFrame').click()
                except:
                    pass
            time.sleep(5)
            try:
                driver.switch_to.window(driver.window_handles[1])
                driver.close()
                driver.switch_to.window(driver.window_handles[0])
                time.sleep(5)
            except:
                pass
            driver.back()
            time.sleep(5)
        else:
            add += 1

    print('finish!')
    driver.quit()

def main():
    Operation('https://member.pointmail.rakuten.co.jp/box', user_name, user_passwd)

if __name__ == '__main__':
    main()

発生している問題・エラー

コード実行後のエラー

Traceback (most recent call last):
  File "mail_de_point.py", line 4, in <module>
    import chromedriver_binary
ModuleNotFoundError: No module named 'chromedriver_binary'

installをしようとしたあとのエラー

 % pip3 install chromedriver-binary
Collecting chromedriver-binary
  Using cached chromedriver-binary-103.0.5060.24.0.tar.gz (5.0 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: chromedriver-binary
  Building wheel for chromedriver-binary (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
   exit code: 1
  ╰─> [78 lines of output]
      running bdist_wheel
      running build
      running build_py
      
      Downloading Chromedriver...
      
      Traceback (most recent call last):
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1350, in do_open
          h.request(req.get_method(), req.selector, req.data, headers,
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1255, in request
          self._send_request(method, url, body, headers, encode_chunked)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1301, in _send_request
          self.endheaders(body, encode_chunked=encode_chunked)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1250, in endheaders
          self._send_output(message_body, encode_chunked=encode_chunked)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1010, in _send_output
          self.send(msg)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 950, in send
          self.connect()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1424, in connect
          self.sock = self._context.wrap_socket(self.sock,
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
          return self.sslsocket_class._create(
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
          self.do_handshake()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
          self._sslobj.do_handshake()
      ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-k_3uf5o0/chromedriver-binary_21d6b1a36ba9470287a0f617da72d2fc/setup.py", line 44, in run
          response = urlopen(url)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
          return opener.open(url, data, timeout)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
          response = self._open(req, data)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
          result = self._call_chain(self.handle_open, protocol, protocol +
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
          result = func(*args)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1393, in https_open
          return self.do_open(http.client.HTTPSConnection, req,
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1353, in do_open
          raise URLError(err)
      urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)>
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-k_3uf5o0/chromedriver-binary_21d6b1a36ba9470287a0f617da72d2fc/setup.py", line 59, in <module>
          setup(
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 165, in setup
          return distutils.core.setup(**attrs)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-k_3uf5o0/chromedriver-binary_21d6b1a36ba9470287a0f617da72d2fc/setup.py", line 48, in run
          raise RuntimeError('Failed to download chromedriver archive: {}'.format(url))
      RuntimeError: Failed to download chromedriver archive: https://chromedriver.storage.googleapis.com/103.0.5060.24/chromedriver_mac64.zip
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for chromedriver-binary
  Running setup.py clean for chromedriver-binary
Failed to build chromedriver-binary
Installing collected packages: chromedriver-binary
  Running setup.py install for chromedriver-binary ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for chromedriver-binary did not run successfully.
   exit code: 1
  ╰─> [80 lines of output]
      running install
      running build
      running build_py
      
      Downloading Chromedriver...
      
      Traceback (most recent call last):
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1350, in do_open
          h.request(req.get_method(), req.selector, req.data, headers,
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1255, in request
          self._send_request(method, url, body, headers, encode_chunked)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1301, in _send_request
          self.endheaders(body, encode_chunked=encode_chunked)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1250, in endheaders
          self._send_output(message_body, encode_chunked=encode_chunked)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1010, in _send_output
          self.send(msg)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 950, in send
          self.connect()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1424, in connect
          self.sock = self._context.wrap_socket(self.sock,
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
          return self.sslsocket_class._create(
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
          self.do_handshake()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
          self._sslobj.do_handshake()
      ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-k_3uf5o0/chromedriver-binary_21d6b1a36ba9470287a0f617da72d2fc/setup.py", line 44, in run
          response = urlopen(url)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
          return opener.open(url, data, timeout)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
          response = self._open(req, data)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
          result = self._call_chain(self.handle_open, protocol, protocol +
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
          result = func(*args)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1393, in https_open
          return self.do_open(http.client.HTTPSConnection, req,
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1353, in do_open
          raise URLError(err)
      urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)>
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-k_3uf5o0/chromedriver-binary_21d6b1a36ba9470287a0f617da72d2fc/setup.py", line 59, in <module>
          setup(
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 165, in setup
          return distutils.core.setup(**attrs)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/install.py", line 61, in run
          return orig.install.run(self)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/install.py", line 545, in run
          self.run_command('build')
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-k_3uf5o0/chromedriver-binary_21d6b1a36ba9470287a0f617da72d2fc/setup.py", line 48, in run
          raise RuntimeError('Failed to download chromedriver archive: {}'.format(url))
      RuntimeError: Failed to download chromedriver archive: https://chromedriver.storage.googleapis.com/103.0.5060.24/chromedriver_mac64.zip
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> chromedriver-binary

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
0

1Answer

SSL: CERTIFICATE_VERIFY_FAILED

と書いてある通り、SSLの証明書が有効ではないため、pyPIからモジュールをダウンロードできていません。

SSL: CERTIFICATE_VERIFY_FAILED python OS X
でググると、python3.6 のバグのようです。最新版では直っているようなのでpythonをアップデートする事をオススメします。
0Like

Comments

  1. @hetare

    Questioner

    お教えいただきありがとうございます!

    updateし、python3.8.7に再度installしようとしたのですが
    ```
    % pip3 install chromedriver_binary
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Collecting chromedriver_binary
    Using cached chromedriver-binary-103.0.5060.24.0.tar.gz (5.0 kB)
    Preparing metadata (setup.py) ... done
    Building wheels for collected packages: chromedriver_binary
    Building wheel for chromedriver_binary (setup.py) ... error
    error: subprocess-exited-with-error

    × python setup.py bdist_wheel did not run successfully.
    │ exit code: 1
    ╰─> [78 lines of output]
    running bdist_wheel
    running build
    running build_py

    Downloading Chromedriver...

    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1350, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1010, in _send_output
    self.send(msg)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 950, in send
    self.connect()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1424, in connect
    self.sock = self._context.wrap_socket(self.sock,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-wy927nyk/chromedriver-binary_16a938c54a44460ba4774e0741bc3ca8/setup.py", line 44, in run
    response = urlopen(url)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1393, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1353, in do_open
    raise URLError(err)
    urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)>

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-wy927nyk/chromedriver-binary_16a938c54a44460ba4774e0741bc3ca8/setup.py", line 59, in <module>
    setup(
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 165, in setup
    return distutils.core.setup(**attrs)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
    self.run_command('build')
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
    File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-wy927nyk/chromedriver-binary_16a938c54a44460ba4774e0741bc3ca8/setup.py", line 48, in run
    raise RuntimeError('Failed to download chromedriver archive: {}'.format(url))
    RuntimeError: Failed to download chromedriver archive: https://chromedriver.storage.googleapis.com/103.0.5060.24/chromedriver_mac64.zip
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for chromedriver_binary
    Running setup.py clean for chromedriver_binary
    Failed to build chromedriver_binary
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Installing collected packages: chromedriver_binary
    Running setup.py install for chromedriver_binary ... error
    error: subprocess-exited-with-error

    × Running setup.py install for chromedriver_binary did not run successfully.
    │ exit code: 1
    ╰─> [80 lines of output]
    running install
    running build
    running build_py

    Downloading Chromedriver...

    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1350, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1010, in _send_output
    self.send(msg)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 950, in send
    self.connect()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1424, in connect
    self.sock = self._context.wrap_socket(self.sock,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-wy927nyk/chromedriver-binary_16a938c54a44460ba4774e0741bc3ca8/setup.py", line 44, in run
    response = urlopen(url)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1393, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1353, in do_open
    raise URLError(err)
    urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)>

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-wy927nyk/chromedriver-binary_16a938c54a44460ba4774e0741bc3ca8/setup.py", line 59, in <module>
    setup(
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 165, in setup
    return distutils.core.setup(**attrs)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/install.py", line 545, in run
    self.run_command('build')
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
    File "/private/var/folders/dw/5pmzllmj1dj6t0r0lzfk3c440000gn/T/pip-install-wy927nyk/chromedriver-binary_16a938c54a44460ba4774e0741bc3ca8/setup.py", line 48, in run
    raise RuntimeError('Failed to download chromedriver archive: {}'.format(url))
    RuntimeError: Failed to download chromedriver archive: https://chromedriver.storage.googleapis.com/103.0.5060.24/chromedriver_mac64.zip
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    error: legacy-install-failure

    × Encountered error while trying to install package.
    ╰─> chromedriver_binary

    note: This is an issue with the package mentioned above, not pip.
    hint: See above for output from the failure.
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    ```

    またエラーとなり
    こちらの記事を見て
    https://qiita.com/orangain/items/0a641d980019fd7e0c52

    % /Applications/Python\ 3.8/Install\ Certificates.command
    をしてみたのですが
    ```
    % /Applications/Python\ 3.8/Install\ Certificates.command
    -- pip install --upgrade certifi
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (2021.10.8)
    Collecting certifi
    Using cached certifi-2022.6.15-py3-none-any.whl (160 kB)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Installing collected packages: certifi
    Attempting uninstall: certifi
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Found existing installation: certifi 2021.10.8
    Uninstalling certifi-2021.10.8:
    ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/certifi-2021.10.8.dist-info/RECORD'
    Consider using the `--user` option or check the permissions.

    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Traceback (most recent call last):
    File "<stdin>", line 44, in <module>
    File "<stdin>", line 24, in main
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8', '-E', '-s', '-m', 'pip', 'install', '--upgrade', 'certifi']' returned non-zero exit status 1.
    ```
    となりました。
  2. @hetare

    Questioner

    文章が変な感じになってました、すみません。

    python3.8.7です。
  3. /Applications/Python 3.8
    のフォルダに
    Install Certificates.command
    というファイルがあればそれを**ダブルクリック**してみてください
    ダブルクリックして実行した場合、パスワードを要求されると思うので入力してください
  4. @hetare

    Questioner

    ありがとうございます。ダブルクリックしてみました。ターミナルで下記のようになりました。これは完了したということでしょうか。

    またこのあとは
    pip3 install chromedriver_binary
    をする流れでしょうか。

    Last login: Thu Jun 16 13:46:21 on ttys003
    /Applications/Python\ 3.8/Install\ Certificates.command ; exit;
    noMacBook-Air ~ % /Applications/Python\ 3.8/Install\ Certificates.command ; exit;
    -- pip install --upgrade certifi
    WARNING: Ignoring invalid distribution - (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution - (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (2021.10.8)
    Collecting certifi
    Using cached certifi-2022.6.15-py3-none-any.whl (160 kB)
    WARNING: Ignoring invalid distribution - (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Installing collected packages: certifi
    Attempting uninstall: certifi
    WARNING: Ignoring invalid distribution - (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Found existing installation: certifi 2021.10.8
    Uninstalling certifi-2021.10.8:
    ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/certifi-2021.10.8.dist-info/RECORD'
    Consider using the `--user` option or check the permissions.

    WARNING: Ignoring invalid distribution - (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution - (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution - (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    WARNING: Ignoring invalid distribution -ertifi (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
    Traceback (most recent call last):
    File "<stdin>", line 44, in <module>
    File "<stdin>", line 24, in main
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8', '-E', '-s', '-m', 'pip', 'install', '--upgrade', 'certifi']' returned non-zero exit status 1.

    [プロセスが完了しました]

Your answer might help someone💌