pip install selenium ERROR python 3.7 Windows 10

Go To StackoverFlow.com

2

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.

2018-07-09 06:29
by Travis Smith
I guess you are typing into Python shel - Mufeed 2018-07-09 06:33
Exit from Python shell and type into terminal - Mufeed 2018-07-09 06:34
type in cmd prompt, not python shell, have you already install pip in your windows? if not first you need to install then run your comman - Anshuman Sharma 2018-07-09 06:41


4

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
2018-07-09 06:35
by Mufeed


0

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.

2018-07-09 06:38
by Lucifer


0

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
2018-07-09 06:39
by DebanjanB


-1

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

2018-07-09 06:36
by mahesh
why user should go to that location? it will be already under environment variables, the issue here is user is trying in python shell instead of command line - raviraja 2018-07-09 06:38
issue is correct but not sure if he added it in env variables, so easy way to move to location and run - mahesh 2018-07-09 06:40
If the environment variables is the issue, the error would have been different - raviraja 2018-07-09 06:41
for windows env you need to move to location for pip, for shell its acceptabl - mahesh 2018-07-09 06:43
Ads