본문 바로가기
아무거나

[python] 웹스크래핑/크롤링 시 유용한 selenium 설치

by 드바 2024. 7. 28.

 

파이썬 패키지 설치

웹스크래핑 시 유용하게 사용되는 seleninum 설치

윈도우에 파이썬이 미리 설치되어 있어야 하고

CMD 창에서 pip 명령을 사용하여 패키지 설치가 가능합니다.

파이썬 소프트웨어 패키지를 한 번의 명령어 실행으로 설치할 수 있다:
pip install some-package-name
패키지 제거 또한 쉽게 실행할 수 있다:
pip uninstall some-package-name

 

패키지 설치 로그

여러 가지 패키지를 한방에 설치할 수 도 있습니다
pip install bs4 selenium webdriver_manager pandas openpyxl

 

-- 아래는 bs4, selenium, webdriver_manager, pandas, openpyxl 패키지 철치 로그입니다

--# bs4 설치
C:\Users\tws>pip install bs4
Collecting bs4
  Downloading bs4-0.0.2-py2.py3-none-any.whl.metadata (411 bytes)
Collecting beautifulsoup4 (from bs4)
  Downloading beautifulsoup4-4.12.3-py3-none-any.whl.metadata (3.8 kB)
Collecting soupsieve>1.2 (from beautifulsoup4->bs4)
  Downloading soupsieve-2.5-py3-none-any.whl.metadata (4.7 kB)
Downloading bs4-0.0.2-py2.py3-none-any.whl (1.2 kB)
Downloading beautifulsoup4-4.12.3-py3-none-any.whl (147 kB)
   ---------------------------------------- 147.9/147.9 kB 1.8 MB/s eta 0:00:00
Downloading soupsieve-2.5-py3-none-any.whl (36 kB)
Installing collected packages: soupsieve, beautifulsoup4, bs4
Successfully installed beautifulsoup4-4.12.3 bs4-0.0.2 soupsieve-2.5

[notice] A new release of pip is available: 24.0 -> 24.1.2
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\Users\tws>python.exe -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\tws\appdata\local\programs\python\python312\lib\site-packages (24.0)
Collecting pip
  Downloading pip-24.1.2-py3-none-any.whl.metadata (3.6 kB)
Downloading pip-24.1.2-py3-none-any.whl (1.8 MB)
   ---------------------------------------- 1.8/1.8 MB 5.3 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 24.0
    Uninstalling pip-24.0:
      Successfully uninstalled pip-24.0
Successfully installed pip-24.1.2

C:\Users\tws>pip install bs4
Requirement already satisfied: bs4 in c:\users\tws\appdata\local\programs\python\python312\lib\site-packages (0.0.2)
Requirement already satisfied: beautifulsoup4 in c:\users\tws\appdata\local\programs\python\python312\lib\site-packages (from bs4) (4.12.3)
Requirement already satisfied: soupsieve>1.2 in c:\users\tws\appdata\local\programs\python\python312\lib\site-packages (from beautifulsoup4->bs4) (2.5)

C:\Users\tws>pip install webdriver-manager
Collecting webdriver-manager
  Downloading webdriver_manager-4.0.1-py2.py3-none-any.whl.metadata (12 kB)
Collecting requests (from webdriver-manager)
  Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting python-dotenv (from webdriver-manager)
  Downloading python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)
Collecting packaging (from webdriver-manager)
  Downloading packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting charset-normalizer<4,>=2 (from requests->webdriver-manager)
  Downloading charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl.metadata (34 kB)
Collecting idna<4,>=2.5 (from requests->webdriver-manager)
  Downloading idna-3.7-py3-none-any.whl.metadata (9.9 kB)
Collecting urllib3<3,>=1.21.1 (from requests->webdriver-manager)
  Downloading urllib3-2.2.2-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests->webdriver-manager)
  Downloading certifi-2024.7.4-py3-none-any.whl.metadata (2.2 kB)
Downloading webdriver_manager-4.0.1-py2.py3-none-any.whl (27 kB)
Downloading packaging-24.1-py3-none-any.whl (53 kB)
   ---------------------------------------- 54.0/54.0 kB 2.7 MB/s eta 0:00:00
Downloading python_dotenv-1.0.1-py3-none-any.whl (19 kB)
Downloading requests-2.32.3-py3-none-any.whl (64 kB)
   ---------------------------------------- 64.9/64.9 kB ? eta 0:00:00
Downloading certifi-2024.7.4-py3-none-any.whl (162 kB)
   ---------------------------------------- 163.0/163.0 kB 2.5 MB/s eta 0:00:00
Downloading charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl (100 kB)
   ---------------------------------------- 100.4/100.4 kB 5.6 MB/s eta 0:00:00
Downloading idna-3.7-py3-none-any.whl (66 kB)
   ---------------------------------------- 66.8/66.8 kB 3.5 MB/s eta 0:00:00
Downloading urllib3-2.2.2-py3-none-any.whl (121 kB)
   ---------------------------------------- 121.4/121.4 kB 7.4 MB/s eta 0:00:00
Installing collected packages: urllib3, python-dotenv, packaging, idna, charset-normalizer, certifi, requests, webdriver-manager
Successfully installed certifi-2024.7.4 charset-normalizer-3.3.2 idna-3.7 packaging-24.1 python-dotenv-1.0.1 requests-2.32.3 urllib3-2.2.2 webdriver-manager-4.0.1

C:\Users\tws>


--# selenium 설치
C:\Users\tws>pip install selenium
Collecting selenium
  Downloading selenium-4.22.0-py3-none-any.whl.metadata (7.0 kB)
Requirement already satisfied: urllib3<3,>=1.26 in c:\users\tws\appdata\local\programs\python\python312\lib\site-packages (from urllib3[socks]<3,>=1.26->selenium) (2.2.2)
Collecting trio~=0.17 (from selenium)
  Downloading trio-0.26.0-py3-none-any.whl.metadata (8.8 kB)
Collecting trio-websocket~=0.9 (from selenium)
  Downloading trio_websocket-0.11.1-py3-none-any.whl.metadata (4.7 kB)
Requirement already satisfied: certifi>=2021.10.8 in c:\users\tws\appdata\local\programs\python\python312\lib\site-packages (from selenium) (2024.7.4)
Collecting typing_extensions>=4.9.0 (from selenium)
  Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting websocket-client>=1.8.0 (from selenium)
  Downloading websocket_client-1.8.0-py3-none-any.whl.metadata (8.0 kB)
Collecting attrs>=23.2.0 (from trio~=0.17->selenium)
  Downloading attrs-23.2.0-py3-none-any.whl.metadata (9.5 kB)
Collecting sortedcontainers (from trio~=0.17->selenium)
  Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl.metadata (10 kB)
Requirement already satisfied: idna in c:\users\tws\appdata\local\programs\python\python312\lib\site-packages (from trio~=0.17->selenium) (3.7)
Collecting outcome (from trio~=0.17->selenium)
  Downloading outcome-1.3.0.post0-py2.py3-none-any.whl.metadata (2.6 kB)
Collecting sniffio>=1.3.0 (from trio~=0.17->selenium)
  Downloading sniffio-1.3.1-py3-none-any.whl.metadata (3.9 kB)
Collecting cffi>=1.14 (from trio~=0.17->selenium)
  Downloading cffi-1.16.0-cp312-cp312-win_amd64.whl.metadata (1.5 kB)
Collecting wsproto>=0.14 (from trio-websocket~=0.9->selenium)
  Downloading wsproto-1.2.0-py3-none-any.whl.metadata (5.6 kB)
Collecting pysocks!=1.5.7,<2.0,>=1.5.6 (from urllib3[socks]<3,>=1.26->selenium)
  Downloading PySocks-1.7.1-py3-none-any.whl.metadata (13 kB)
Collecting pycparser (from cffi>=1.14->trio~=0.17->selenium)
  Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Collecting h11<1,>=0.9.0 (from wsproto>=0.14->trio-websocket~=0.9->selenium)
  Downloading h11-0.14.0-py3-none-any.whl.metadata (8.2 kB)
Downloading selenium-4.22.0-py3-none-any.whl (9.4 MB)
   ---------------------------------------- 9.4/9.4 MB 7.3 MB/s eta 0:00:00
Downloading trio-0.26.0-py3-none-any.whl (475 kB)
   ---------------------------------------- 475.7/475.7 kB 9.9 MB/s eta 0:00:00
Downloading trio_websocket-0.11.1-py3-none-any.whl (17 kB)
Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Downloading websocket_client-1.8.0-py3-none-any.whl (58 kB)
   ---------------------------------------- 58.8/58.8 kB ? eta 0:00:00
Downloading attrs-23.2.0-py3-none-any.whl (60 kB)
   ---------------------------------------- 60.8/60.8 kB ? eta 0:00:00
Downloading cffi-1.16.0-cp312-cp312-win_amd64.whl (181 kB)
   ---------------------------------------- 182.0/182.0 kB 11.4 MB/s eta 0:00:00
Downloading PySocks-1.7.1-py3-none-any.whl (16 kB)
Downloading sniffio-1.3.1-py3-none-any.whl (10 kB)
Downloading wsproto-1.2.0-py3-none-any.whl (24 kB)
Downloading outcome-1.3.0.post0-py2.py3-none-any.whl (10 kB)
Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB)
Downloading h11-0.14.0-py3-none-any.whl (58 kB)
   ---------------------------------------- 58.3/58.3 kB ? eta 0:00:00
Downloading pycparser-2.22-py3-none-any.whl (117 kB)
   ---------------------------------------- 117.6/117.6 kB 7.2 MB/s eta 0:00:00
Installing collected packages: sortedcontainers, websocket-client, typing_extensions, sniffio, pysocks, pycparser, h11, attrs, wsproto, outcome, cffi, trio, trio-websocket, selenium
Successfully installed attrs-23.2.0 cffi-1.16.0 h11-0.14.0 outcome-1.3.0.post0 pycparser-2.22 pysocks-1.7.1 selenium-4.22.0 sniffio-1.3.1 sortedcontainers-2.4.0 trio-0.26.0 trio-websocket-0.11.1 typing_extensions-4.12.2 websocket-client-1.8.0 wsproto-1.2.0

C:\Users\tws>


–# webdriver_manager 설치
C:\Users\HK>pip install webdriver_manager
Collecting webdriver_manager
  Downloading webdriver_manager-4.0.1-py2.py3-none-any.whl.metadata (12 kB)
Collecting requests (from webdriver_manager)
  Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting python-dotenv (from webdriver_manager)
  Downloading python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)
Collecting packaging (from webdriver_manager)
  Downloading packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting charset-normalizer<4,>=2 (from requests->webdriver_manager)
  Downloading charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl.metadata (34 kB)
Requirement already satisfied: idna<4,>=2.5 in c:\users\hk\appdata\local\programs\python\python312\lib\site-packages (from requests->webdriver_manager) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\hk\appdata\local\programs\python\python312\lib\site-packages (from requests->webdriver_manager) (2.2.2)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\hk\appdata\local\programs\python\python312\lib\site-packages (from requests->webdriver_manager) (2024.7.4)
Downloading webdriver_manager-4.0.1-py2.py3-none-any.whl (27 kB)
Downloading packaging-24.1-py3-none-any.whl (53 kB)
   ---------------------------------------- 54.0/54.0 kB ? eta 0:00:00
Downloading python_dotenv-1.0.1-py3-none-any.whl (19 kB)
Downloading requests-2.32.3-py3-none-any.whl (64 kB)
   ---------------------------------------- 64.9/64.9 kB 3.6 MB/s eta 0:00:00
Downloading charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl (100 kB)
   ---------------------------------------- 100.4/100.4 kB ? eta 0:00:00
Installing collected packages: python-dotenv, packaging, charset-normalizer, requests, webdriver_manager
Successfully installed charset-normalizer-3.3.2 packaging-24.1 python-dotenv-1.0.1 requests-2.32.3 webdriver_manager-4.0.1


--# pandas, openpyxl 설치
C:\Users\tws>pip install pandas openpyxl
Collecting pandas
  Downloading pandas-2.2.2-cp312-cp312-win_amd64.whl.metadata (19 kB)
Collecting openpyxl
  Downloading openpyxl-3.1.5-py2.py3-none-any.whl.metadata (2.5 kB)
Collecting numpy>=1.26.0 (from pandas)
  Downloading numpy-2.0.0-cp312-cp312-win_amd64.whl.metadata (60 kB)
     ---------------------------------------- 60.9/60.9 kB ? eta 0:00:00
Collecting python-dateutil>=2.8.2 (from pandas)
  Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting pytz>=2020.1 (from pandas)
  Downloading pytz-2024.1-py2.py3-none-any.whl.metadata (22 kB)
Collecting tzdata>=2022.7 (from pandas)
  Downloading tzdata-2024.1-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting et-xmlfile (from openpyxl)
  Downloading et_xmlfile-1.1.0-py3-none-any.whl.metadata (1.8 kB)
Collecting six>=1.5 (from python-dateutil>=2.8.2->pandas)
  Downloading six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Downloading pandas-2.2.2-cp312-cp312-win_amd64.whl (11.5 MB)
   ---------------------------------------- 11.5/11.5 MB 8.1 MB/s eta 0:00:00
Downloading openpyxl-3.1.5-py2.py3-none-any.whl (250 kB)
   ---------------------------------------- 250.9/250.9 kB 7.8 MB/s eta 0:00:00
Downloading numpy-2.0.0-cp312-cp312-win_amd64.whl (16.2 MB)
   ---------------------------------------- 16.2/16.2 MB 8.2 MB/s eta 0:00:00
Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
   ---------------------------------------- 229.9/229.9 kB 13.7 MB/s eta 0:00:00
Downloading pytz-2024.1-py2.py3-none-any.whl (505 kB)
   ---------------------------------------- 505.5/505.5 kB 10.5 MB/s eta 0:00:00
Downloading tzdata-2024.1-py2.py3-none-any.whl (345 kB)
   ---------------------------------------- 345.4/345.4 kB 10.8 MB/s eta 0:00:00
Downloading et_xmlfile-1.1.0-py3-none-any.whl (4.7 kB)
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: pytz, tzdata, six, numpy, et-xmlfile, python-dateutil, openpyxl, pandas
Successfully installed et-xmlfile-1.1.0 numpy-2.0.0 openpyxl-3.1.5 pandas-2.2.2 python-dateutil-2.9.0.post0 pytz-2024.1 six-1.16.0 tzdata-2024.1

C:\Users\tws>

 

댓글