Python3 ModuleNotFoundError: No module named 'selenium' エラーということで、Pythonで自動化をいろいろと試行錯誤していこうと思っています。
ブラウザを起動してURL接続ということで、さっそく、Pythonインストール後に、 from selenium import webdriverでエラーがでました。
結論から言うと、以下がSeleniumがインストールされていない場合に発生するエラーとのことで、「pip install selenium」でインストールして解消しました。
C:\Users\Administrator>pip install selenium
Collecting selenium
Downloading selenium-4.29.0-py3-none-any.whl.metadata (7.1 kB)
Collecting urllib3<3,>=1.26 (from urllib3[socks]<3,>=1.26->selenium)
Downloading urllib3-2.3.0-py3-none-any.whl.metadata (6.5 kB)
Collecting trio~=0.17 (from selenium)
Downloading trio-0.29.0-py3-none-any.whl.metadata (8.5 kB)
Collecting trio-websocket~=0.9 (from selenium)
Downloading trio_websocket-0.12.2-py3-none-any.whl.metadata (5.1 kB)
Collecting certifi>=2021.10.8 (from selenium)
Downloading certifi-2025.1.31-py3-none-any.whl.metadata (2.5 kB)
Collecting typing_extensions~=4.9 (from selenium)
Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting websocket-client~=1.8 (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-25.3.0-py3-none-any.whl.metadata (10 kB)
Collecting sortedcontainers (from trio~=0.17->selenium)
Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl.metadata (10 kB)
Collecting idna (from trio~=0.17->selenium)
Downloading idna-3.10-py3-none-any.whl.metadata (10 kB)
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.17.1-cp313-cp313-win_amd64.whl.metadata (1.6 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.29.0-py3-none-any.whl (9.5 MB)
---------------------------------------- 9.5/9.5 MB 6.5 MB/s eta 0:00:00
Downloading certifi-2025.1.31-py3-none-any.whl (166 kB)
Downloading trio-0.29.0-py3-none-any.whl (492 kB)
Downloading trio_websocket-0.12.2-py3-none-any.whl (21 kB)
Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Downloading urllib3-2.3.0-py3-none-any.whl (128 kB)
Downloading websocket_client-1.8.0-py3-none-any.whl (58 kB)
Downloading attrs-25.3.0-py3-none-any.whl (63 kB)
Downloading cffi-1.17.1-cp313-cp313-win_amd64.whl (182 kB)
Downloading outcome-1.3.0.post0-py2.py3-none-any.whl (10 kB)
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 idna-3.10-py3-none-any.whl (70 kB)
Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB)
Downloading h11-0.14.0-py3-none-any.whl (58 kB)
Downloading pycparser-2.22-py3-none-any.whl (117 kB)
Installing collected packages: sortedcontainers, websocket-client, urllib3, typing_extensions, sniffio, pysocks, pycparser, idna, h11, certifi, attrs, wsproto, outcome, cffi, trio, trio-websocket, selenium
Successfully installed attrs-25.3.0 certifi-2025.1.31 cffi-1.17.1 h11-0.14.0 idna-3.10 outcome-1.3.0.post0 pycparser-2.22 pysocks-1.7.1 selenium-4.29.0 sniffio-1.3.1 sortedcontainers-2.4.0 trio-0.29.0 trio-websocket-0.12.2 typing_extensions-4.12.2 urllib3-2.3.0 websocket-client-1.8.0 wsproto-1.2.0[notice] A new release of pip is available: 24.3.1 -> 25.0.1
[notice] To update, run: python.exe -m pip install --upgrade pip
Pythonを極めると、システムの起動停止をすべて自動化できるそうです。
![]() |
エレコム マウス ワイヤレス Mサイズ 5ボタン(戻る・進むボタン搭載) BlueLED 握りの極み ガンメタリック M-XGM10DBBK/EC |