SyntaxError: Why Does Pip Install Invalid Syntax?

561    Asked by Amitjaisawal in Python , Asked on Nov 16, 2022

I'm trying to use pip to install a package. I try to run pip install from the Python shell, but I get a SyntaxError. How do I use pip to install the package without getting python pip invalid syntax error?


>>> pip install selenium 
^
SyntaxE
r
r
o
r: invalid syntax
Answered by Amanda Hawes

In case of invalid syntax pip install -


Use the command line, not the Python shell (DOS, PowerShell in Windows).
C:Program FilesPython2.7Scripts> pip install XYZ
If you installed Python into your PATH using the latest installers, you don't need to be in that folder to run pip
Terminal in Mac or Linux
$ pip install XYZ

Your Answer

Interviews

Parent Categories