I downloaded Python 3.7 just now. Now I'm trying to install the selenium module. I am able to run python in my command prompt. But, when I type:
pip install -U selenium
or
pip install selenium
I get a syntax error.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> pip install -U selenium
File "<stdin>", line 1
pip install -U selenium
^
SyntaxError: invalid syntax
I'm thinking it's a bug with the new Python version, but not sure if anybody can tell me what I did wrong.
You are typing into Python shell
.
To leave the interactive shell and go back to the console (the system shell), press Ctrl-Z
and then Enter on Windows, or Ctrl-D on OS X or Linux. Alternatively, you could also run the python command exit()
.
Then type into Command line Interface.
By the way I believe you need to install using pip3
rather than pip
, since you are using python3.X.
So command would be
pip3 install -U selenium
You are typing the command in python shell. Use quit() command to exit out of it and then run the pip command again You can tell the difference by the sign in the front.
The reason you are seeing error with the lines:
>>> pip install -U selenium
and
>>> pip install selenium
because you have issued those commands within the Python Shell.
Ideally, you should issue the commands from the Command Line Interface as:
>pip install -U selenium
Incase pip
requires upgradation, you need to execute the following command from the Command Prompt:
>python -m pip install -U pip
you need to install if from command line, go to python folder under below location
cd C:\Users{username}\AppData\Local\Programs\Python{python version}\Scripts
pip install selenium