C:\Users\dani>pip install selenium 'pip' is not recognized as an internal or external command, operable program or batch file. C:\Users\dani>sudo pip install selenium 'sudo' is not recognized as an internal or external command, operable program or batch file. C:\Users\dani>pip3 install selenium 'pip3' is not recognized as an internal or external command, operable program or batch file. C:\Users\dani>conda install selenium 'conda' is not recognized as an internal or external command, operable program or batch file.
The error you are recieving means that none of the base commands you are using (
pip) are registered with Windows for use at the command line.
Assuming that you selected the option to register
python itself at the command line when you installed it, try
python -m pip install -U selenium.
In this case:
python -m pipinvokes the version of
piplocated in your
install -U seleniumtells
pipto install (and upgrade) Selenium. If you have never installed Selenium, it's fine to drop the
-Uoption, but it won't hurt if you leave it in either.
On the off chance you get
'python' is not recognized as an internal or external command, operable program or batch file, you can:
Reinstall Python and select the option to register Python in your Windows PATH/Path variable(s) (arguably overkill).
python.exeto your PATH/Path variable(s) manually.
Use the full path to
pythonin your command e.g.
C:\Python37\python.exe -m pip install -U selenium.
Manually Adding Python To Your Path
To manually add
python.exe to your Path variable in Windows 7 and Windows 10:
Open the Start Menu Search box and type
Choose the option to "Edit the system environment variables".
In the dialog box that appear, click the "Environment Variables…" button at the bottom of the active tab.
In the new dialog box that appears, look for the "System Variables" section in the lower half.
Select the Variable (the first column) marked as "Path" (i.e. click on it), then click the "Edit..." button.
In the "Edit environment variable" dialog box that appears, add a semicolon (
;) to the end of the existing string, then add the full path to your
C:\Python37\python.exeor similar). So the full string you append should look something like e.g.
Manually Installing Selenium
However, if the options above are failing, you can download the correct Selenium package manually.
.whl (wheel) file, you would still use
pip to install Selenium by opening a command window in the same directory and typing e.g.
C:\Python37\python.exe -m pip install -U selenium (as above).
tar.gz file, you would fully extract the archive, open a command window in the extracted directory where
setup.py resides, then run
python setup.py install (or e.g.
C:\Python37\python.exe setup.py install).
If you choose to manually download and install Selenium, pick one format or the other (i.e
.tar.gz). It's likely worth mentioning that there is no practical difference between the two for your purposes.
Notes On Commands
sudo pip install selenium-
sudois a Linux command, so in order to even have a chance for this to work on Windows 10, you would need to be in the Windows Subsystem for Linux (WSL).
conda install selenium-
condais specific to Anaconda, which is a self-contained environment for Python.
pip install selenium- this can work if you installed vanilla Python for Windows from python.org. But
pip.exewould still need to be registered at the command line (see steps for
python.exeabove and simply substitute the full path to