我的代码:
from selenium import webdriver
driver= webdriver.Firefox()
driver.get("http://google.com")
收到以下错误消息
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/selenium.py", line 23, in <module>
NewjerseyCalifornia
import http.client as http_client
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 71, in <module>
import email.parser
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/feedparser.py", line 27, in <module>
from email import message
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/message.py", line 16, in <module>
from email import utils
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/utils.py", line 40, in <module>
from email.charset import Charset
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/charset.py", line 15, in <module>
import email.quoprimime
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/quoprimime.py", line 44, in <module>
from string import ascii_letters, digits, hexdigits
ImportError: cannot import name 'ascii_letters'
在处理上述异常期间,发生了另一个异常:
Traceback (most recent call last): File "/Users/asimali/PycharmProjects/Asim/com/introduction/Basics_Selenium.py", line 4, in <module>
from selenium import webdriver File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/__init__.py", line 18, in <module>
from selenium import selenium File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/selenium.py", line 25, in <module>
import httplib as http_client ImportError: No module named 'httplib' Process finished with exit code 1
注意:我还运行了命令2to3 -w Basics_Selenium.py