一回は環境構築もできて動いていたんですが急に動かなくなりました。
エラーーーーーーーーーーーーーーーーーーーーーーーー
Traceback (most recent call last):
line 1, in <module>
from selenium import webdriver
ImportError: No module named selenium
[Done] exited with code=1 in 0.101 seconds
ーーーーーーーーーーーーーーーーーーーーーーーーーーー
selenium,
chromedriverを使ってchromeを開くと言うプログラムです
ターミナルでpip3 install seleniumとうつと
pip3 install selenium
Requirement already satisfied: selenium in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (3.141.0)
Requirement already satisfied: urllib3 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from selenium) (1.26.7)
エディタはVSCODEを使用
色々調べてきたりもしたんですが解決できないので投稿してみました
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
url='https://www.google.com/?hl=ja'
driver = webdriver.Chrome(executable_path='chromedriver')
driver.get(url)
これでこれで開こうとしてます
vscodeで実行すると
Running] python -u "/Users/Eydis/Desktop/python.py/open.py"
Traceback (most recent call last):
File "/Users/Eydis/Desktop/python.py/open.py", line 1, in <module>
from selenium import webdriver
ImportError: No module named selenium
[Done] exited with code=1 in 0.048 seconds
ターミナルで実行すると
Edyis@Eydis python % python open.py
Traceback (most recent call last):
File "open.py", line 1, in <module>
from selenium import webdriver
ImportError: No module named selenium
python3だと
Edyis@Eydis python % python3 open.py
Traceback (most recent call last):
File "open.py", line 1, in <module>
from selenium import webdriver
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/init.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 29, in <module>
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 27, in <module>
from .remote_connection import RemoteConnection
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 24, in <module>
import urllib3
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/init.py", line 11, in <module>
from . import exceptions
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/exceptions.py", line 3, in <module>
from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py", line 234, in create_module
return self.load_module(spec.name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py", line 209, in load_module
mod = mod._resolve()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py", line 118, in _resolve
return _import_module(self.mod)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py", line 87, in _import_module
import(name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 71, in <module>
import email.parser
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/feedparser.py", line 27, in <module>
from email._policybase import compat32
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/utils.py", line 33, in <module>
from email._parseaddr import quote
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/_parseaddr.py", line 16, in <module>
import time, calendar
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/calendar.py", line 50, in <module>
class _localized_month:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/calendar.py", line 52, in _localized_month
_months = [datetime.date(2001, i+1, 1).strftime for i in range(12)]
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/calendar.py", line 52, in <listcomp>
_months = [datetime.date(2001, i+1, 1).strftime for i in range(12)]
AttributeError: module 'datetime' has no attribute 'date'
Edyis@Eydis python %