Solve the problem of import error: cannot import name webriver

####1. First, you need to know the current selenium directory
create a new Python file as follows:

import selenium 
print selenium.__file__

The printed file path is

C:\Python27\lib\site-packages\selenium\__init__.pyc

####2. Find the folder and file with the same name. There is a file named selenium in the current directory. Python will import this file first, and then import selenium.py in the standard library. In case of this problem, there may be more than one directory selenium with the same name or the file name selenium.py. Through the folder to find duplicate folder or file, it can be deleted or renamed

Only one selenium folder and one selenium.py file are allowed

Now you can execute from selenium import webdriver . If there is no problem, the problem has been solved

####3. If the problem can’t be solved, you can reload selenium

Similar Posts: