Checking whether the pip is installed?

Merto picture Merto · Nov 29, 2016 · Viewed 141.1k times · Source

I am using Python 2.7.12 and I want to check whether the pip is installed or not. For this, in command line of Python application I wrote pip list and pressed enter. However, I get an error like:

File"stdin",line 1

pip list

Syntax Error: invalid syntax

So, how can I solve this issue and get the list of modules as an output?

Thanks

Answer

TimeTrax picture TimeTrax · Apr 20, 2018

Use command line and not python.
TLDR; On Windows, do: python -m pip --version

Details:

On Windows, ~> (open windows terminal)
Start (or Windows Key) > type "cmd" Press Enter
You should see a screen that looks like this enter image description here
To check to see if pip is installed.

python -m pip --version

if pip is installed, go ahead and use it. for example:

Z:\>python -m pip install selenium

if not installed, install pip, and you may need to
add its path to the environment variables.
(basic - windows)
add path to environment variables (basic+advanced)

if python is NOT installed you will get a result similar to the one below

enter image description here

Install python. add its path to environment variables.