pip install selenium ERROR python 3.7 Windows 10
Solution 1
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
Solution 2
python -m pip install selenium --user
pip defaults to installing Python packages to a system directory (such as /usr/local/lib/python3.4
). This requires root access.
--user
makes pip install packages in your home directory instead, which doesn't require any special privileges.
Related videos on Youtube
Comments
-
Travis Smith about 2 years
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.
-
Mufeed almost 6 yearsI guess you are typing into Python shell
-
Mufeed almost 6 yearsExit from Python shell and type into terminal.
-
Anshuman Sharma almost 6 yearstype in cmd prompt, not python shell, have you already install pip in your windows? if not first you need to install then run your command
-
-
raviraja almost 6 yearswhy 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.
-
mahesh almost 6 yearsissue is correct but not sure if he added it in env variables, so easy way to move to location and run.
-
raviraja almost 6 yearsIf the environment variables is the issue, the error would have been different.
-
mahesh almost 6 yearsfor windows env you need to move to location for pip, for shell its acceptable
-
colidyre over 4 yearsHello Furkan. Welcome to StackOverflow. It would be helpful for all readers if you explain your answer a bit. Just providing a code snippet can be helpful and in rare cases it's enough. But here I miss an explanation why this should work and why the OP has problems with his approach.