macOS에 from webdriver_manager.chrome import ChromeDriverManager 설치하는 방법
윈도우에서 사용하던 파이썬 스크립트를 맥북으로 가져왔다.
파이참 IDE를 설치했고, 아나콘다를 설치했다.
필요한 라이브러리들을 설치는 순조로웠지만 크롬 드라이버 관련해서 설치가 정상적으로 되지않았다.
설치된 파이썬 버전은 Python 3.10.0이다.
import urllib.parse from bs4 import BeautifulSoup import time # import pandas from selenium import webdriver import json # import numpy import random import os from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager .....생략 driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get(url) driver.implicitly_wait(10) # seconds time.sleep(random.randint(1, 10)) beautifulSoup = BeautifulSoup(driver.page_source, 'html.parser') map_div = beautifulSoup.find('div', id='map') # print(map_div) map_tag = map_div.find('area').get('alt') # gps = map_tag.replace("마커의 경위도는 ", "").replace("", " 입니다.") # print(map_tag) item.append(map_tag) driver.close()
[해결방법]
파이참에서 터미널창을 열고 다음 설치 명령어를 실행한다.
pip install webdriver-manager
정상적인 설치 로그는 다음과 같다.
pip install webdriver-manager Collecting webdriver-manager Downloading webdriver_manager-3.8.3-py2.py3-none-any.whl (26 kB) Collecting tqdm Downloading tqdm-4.64.0-py2.py3-none-any.whl (78 kB) |████████████████████████████████| 78 kB 1.5 MB/s Collecting python-dotenv Downloading python_dotenv-0.20.0-py3-none-any.whl (17 kB) Collecting requests Downloading requests-2.28.1-py3-none-any.whl (62 kB) |████████████████████████████████| 62 kB 1.4 MB/s Requirement already satisfied: idna<4,>=2.5 in /Users/ddolcat/.conda/envs/pythonProject1/lib/python3.10/site-packages (from requests->webdriver-manager) (3.3) Collecting charset-normalizer<3,>=2 Downloading charset_normalizer-2.1.0-py3-none-any.whl (39 kB) Requirement already satisfied: certifi>=2017.4.17 in /Users/ddolcat/.conda/envs/pythonProject1/lib/python3.10/site-packages (from requests->webdriver-manager) (2022.6.15) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/ddolcat/.conda/envs/pythonProject1/lib/python3.10/site-packages (from requests->webdriver-manager) (1.26.11) Installing collected packages: charset-normalizer, tqdm, requests, python-dotenv, webdriver-manager Successfully installed charset-normalizer-2.1.0 python-dotenv-0.20.0 requests-2.28.1 tqdm-4.64.0 webdriver-manager-3.8.3