解决ImportError: cannot import name webdriver

原文地址为: 解决ImportError: cannot import name webdriver

最近在写一个Python程序的时候,使用from selenium import webdriver,在run的时候却出现ImportError: cannot import name webdriver的提示,但是在Python IDLE里面跑却没有错误。很是疑惑,谷歌一下才发现有人已经在stackoverflow里面提出类似问题了,原因如下,在当前目录有个明教selenium的文件,Python会先导入这个文件,然后再导入标准库里面的selenium.py可以使用import selenium print selenium.__file__去看打印出的文件路径,如果不是下面类似的C:\Python27\lib\site-packages\selenium-2.31.0-py2.7.egg\selenium\__init__.pyc,需要把当前目录下的文件删除或者重命名。


转载请注明本文地址: 解决ImportError: cannot import name webdriver

猜你喜欢

转载自blog.csdn.net/dearbaba_1666/article/details/80567620
今日推荐