質問編集履歴

2

pythonのパスを確認しました

2021/12/29 15:07

投稿

Akari0941
Akari0941

スコア6

test CHANGED
File without changes
test CHANGED
@@ -175,3 +175,5 @@
175
175
  AttributeError: module 'datetime' has no attribute 'date'
176
176
 
177
177
  Edyis@Eydis python %
178
+
179
+ ![イメージ説明](9b44820f1b9c0073542d37ab9263c227.png)

1

python3で実行した時のエラーも追記

2021/12/29 15:07

投稿

Akari0941
Akari0941

スコア6

test CHANGED
File without changes
test CHANGED
@@ -35,3 +35,143 @@
35
35
  エディタはVSCODEを使用
36
36
 
37
37
  色々調べてきたりもしたんですが解決できないので投稿してみました
38
+
39
+ from selenium import webdriver
40
+
41
+ from selenium.webdriver.common.keys import Keys
42
+
43
+
44
+
45
+ url='https://www.google.com/?hl=ja'
46
+
47
+ driver = webdriver.Chrome(executable_path='chromedriver')
48
+
49
+ driver.get(url)
50
+
51
+ これでこれで開こうとしてます
52
+
53
+ vscodeで実行すると
54
+
55
+ Running] python -u "/Users/Eydis/Desktop/python.py/open.py"
56
+
57
+ Traceback (most recent call last):
58
+
59
+ File "/Users/Eydis/Desktop/python.py/open.py", line 1, in <module>
60
+
61
+ from selenium import webdriver
62
+
63
+ ImportError: No module named selenium
64
+
65
+
66
+
67
+ [Done] exited with code=1 in 0.048 seconds
68
+
69
+ ターミナルで実行すると
70
+
71
+ Edyis@Eydis python % python open.py
72
+
73
+ Traceback (most recent call last):
74
+
75
+ File "open.py", line 1, in <module>
76
+
77
+ from selenium import webdriver
78
+
79
+ ImportError: No module named selenium
80
+
81
+ python3だと
82
+
83
+ Edyis@Eydis python % python3 open.py
84
+
85
+ Traceback (most recent call last):
86
+
87
+ File "open.py", line 1, in <module>
88
+
89
+ from selenium import webdriver
90
+
91
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/__init__.py", line 18, in <module>
92
+
93
+ from .firefox.webdriver import WebDriver as Firefox # noqa
94
+
95
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 29, in <module>
96
+
97
+ from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
98
+
99
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 27, in <module>
100
+
101
+ from .remote_connection import RemoteConnection
102
+
103
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 24, in <module>
104
+
105
+ import urllib3
106
+
107
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/__init__.py", line 11, in <module>
108
+
109
+ from . import exceptions
110
+
111
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/exceptions.py", line 3, in <module>
112
+
113
+ from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
114
+
115
+ File "<frozen importlib._bootstrap>", line 971, in _find_and_load
116
+
117
+ File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
118
+
119
+ File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
120
+
121
+ File "<frozen importlib._bootstrap>", line 571, in module_from_spec
122
+
123
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py", line 234, in create_module
124
+
125
+ return self.load_module(spec.name)
126
+
127
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py", line 209, in load_module
128
+
129
+ mod = mod._resolve()
130
+
131
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py", line 118, in _resolve
132
+
133
+ return _import_module(self.mod)
134
+
135
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/packages/six.py", line 87, in _import_module
136
+
137
+ __import__(name)
138
+
139
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 71, in <module>
140
+
141
+ import email.parser
142
+
143
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/parser.py", line 12, in <module>
144
+
145
+ from email.feedparser import FeedParser, BytesFeedParser
146
+
147
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/feedparser.py", line 27, in <module>
148
+
149
+ from email._policybase import compat32
150
+
151
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/_policybase.py", line 9, in <module>
152
+
153
+ from email.utils import _has_surrogates
154
+
155
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/utils.py", line 33, in <module>
156
+
157
+ from email._parseaddr import quote
158
+
159
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/_parseaddr.py", line 16, in <module>
160
+
161
+ import time, calendar
162
+
163
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/calendar.py", line 50, in <module>
164
+
165
+ class _localized_month:
166
+
167
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/calendar.py", line 52, in _localized_month
168
+
169
+ _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)]
170
+
171
+ File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/calendar.py", line 52, in <listcomp>
172
+
173
+ _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)]
174
+
175
+ AttributeError: module 'datetime' has no attribute 'date'
176
+
177
+ Edyis@Eydis python %