1

我一直在与这个错误作斗争。我的背景是: - 全新安装 Lubuntu(基于 ubuntu 15),只需安装 setuptools 和 selenium 2.50 - selenium python3 脚本。

我尝试在另一台机器上运行这个脚本(基于 ubuntu 14 的 lubuntu)并且它运行,但是对于新机器,所有脚本都不起作用。我在大互联网上查找,但找不到答案。我有以下错误:

Traceback (most recent call last):
File "tesst.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/__init__.py", line 18, in <module>
from selenium import selenium
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/selenium.py", line 23, in <module>
import http.client as http_client
File "/usr/lib/python3.4/http/client.py", line 69, in <module>
import email.parser
File "/usr/lib/python3.4/email/parser.py", line 12, in <module>
from email.feedpaarser import FeedParser, BytesFeedParser
File "/usr/lib/python3.4/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib/python3.4/email/message.py", line 16, in <module>
from email import utils
File "/usr/lib/python3.4/email/utils.py", line 33, in <module>
from email._parseaddr import quote
File "/usr/lib/python3.4/email/_parseaddr.py", line 16, in <module>
import time, calendar
File "/home/XXXX/Scripts/XXXX/calendar.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/webdriver/__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/webdriver/firefox/webdriver.py", line 20, in <module>
import http.client as http_client
AttributeError: 'module' object has no attribute 'client'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in <module>
from urllib.request import urlopen
File "/usr/lib/python3.4/urllib/request.py", line 88, in <module>
import http.client
File "/usr/lib/python3.4/http/client.py", line 69, in <module>
import email.parser
File "/usr/lib/python3.4/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib/python3.4/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib/python3.4/email/message.py", line 16, in <module>
from email import utils
File "/usr/lib/python3.4/email/utils.py", line 33, in <module>
from email._parseaddr import quote
File "/usr/lib/python3.4/email/_parseaddr.py", line 16, in <module>
import time, calendar
File "/home/XXXX/Scripts/XXXX/calendar.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/__init__.py", line 18, in <module>
from selenium import selenium
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/selenium.py", line 23, in <module>
import http.client as http_client
AttributeError: 'module' object has no attribute 'client'

Original exception was:
Traceback (most recent call last):
File "tesst.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/__init__.py", line 18, in <module>
from selenium import selenium
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/selenium.py", line 23, in <module>
import http.client as http_client
File "/usr/lib/python3.4/http/client.py", line 69, in <module>
import email.parser
File "/usr/lib/python3.4/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib/python3.4/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib/python3.4/email/message.py", line 16, in <module>
from email import utils
File "/usr/lib/python3.4/email/utils.py", line 33, in <module>
from email._parseaddr import quote
File "/usr/lib/python3.4/email/_parseaddr.py", line 16, in <module>
import time, calendar
File "/home/XXXX/Scripts/XXXX/calendar.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/webdriver/__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/webdriver/firefox/webdriver.py", line 20, in <module>
    import http.client as http_client

在来这里之前我看了很多,但我现在有点迷路了。有人可以帮忙吗,我会非常感激的。谢谢 !!

编辑 :

嘿,我已经尝试了所有这些,但这并不能解决问题。我没有重复的硒,我只是安装 sudo python3 setup.py install在硒目录中。我也没有名为 http.py 的脚本,所以当我这样做时,import http http.__file__它会给我/usr/lib/python3.4/http/__init__.py

4

1 回答 1

0

好吧,让我们面对现实吧,我知道,答案就在我眼前。英石 !!此文件“/home/XXXX/Scripts/XXXX/calendar.py”,第 1 行,在

我有一个脚本名称 calendar.py 作为模块...所以更改名称就完成了。

对不起各位,谢谢你们

于 2016-01-30T13:02:16.340 回答