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
PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.
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.
Installing pip on OS X After the program runs, use the command pip --version (or pip3 --version ) to make sure pip was installed correctly.
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
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
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/
$ 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With