Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking whether pip is installed?

Tags:

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

like image 565
Merto Avatar asked Nov 29 '16 14:11

Merto


People also ask

Is pip installed with Python?

PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.

How do I find pip version in Windows?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists.

How do you check pip is installed or not in Mac?

Installing pip on OS X After the program runs, use the command pip --version (or pip3 --version ) to make sure pip was installed correctly.


2 Answers

Use command line and not python.
TLDR; On Windows, do:
python -m pip --version
OR
py -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.

UPDATE: for newer versions of python replace "python" with py - see @gimmegimme's comment and link https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/

like image 170
TimeTrax Avatar answered Sep 28 '22 17:09

TimeTrax


$ which pip 

or

 $ pip -V  

execute this command into your terminal. It should display the location of executable file eg. /usr/local/bin/pip and the second command will display the version if the pip is installed correctly.

like image 42
Tushar Niras Avatar answered Sep 28 '22 15:09

Tushar Niras