SyntaxError: Why does pip install invalid syntax?

18.6K    Asked by ashish_1000 in Python , Asked on Jun 16, 2021

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 
r: invalid syntax

Answered by Deepa bhawana

The python pip invalid syntax error is occurring because pip is run from the command line, not the Python interpreter. It is a program that installs modules, so you can use them from Python. Once you have installed the module, then you can open the Python shell and do import selenium.

The Python shell is not a command line, it is an interactive interpreter. You type Python code into it, not commands.

Your Answer


Parent Categories