Python comes shipped with OS like ubuntu and macOS
Check python version with
python -V
Check python 3 version(in case above command shows a Python 2 version) with
python3 -V
Contents :
pip
PIP is a package manager for Python packages, or modules
Modules are Python code libraries that can be included in a program, like http, json
A package contains all the files required for a module
pip should get installed along-with Python 2 >=2.7.9 or Python 3 >=3.4 versions
Following command can be used to check if pip is installed (and/or included in system PATH)
pip -V
It prints out the pip version if pip is found
In case not found, check for Python 3 pip
pip3 -V
Unix environments come pre-installed with Python
Check if Python is installed with python -V
or python3 -V
Python can be installed with
sudo apt-get update
sudo apt-get install python
Open a new terminal and try running python -V
or python3 -V
(for python 3)
Python 3.6 can be installed with
sudo apt-get update
sudo apt-get install python3.6
Check if pip is installed with pip -V
or pip3 -V
pip can be installed with
sudo apt-get install python-pip
pip works with Python versions 2.7, 3.5, 3.6, 3.7, 3.8 and also PyPy
sudo apt-get install python3-pip
Following command can be used to upgrade pip
pip install -U pip
Mac environments come pre-installed with Python (probably python 2.7)
Check for python version with python -V
or python3 -V
Check below in case you want to install python 3
Go to https://www.python.org and hover over Downloads tab
There should be a download link of a recent stable Python version
Once downloaded, open it and follow installation steps
Visit https://www.python.org/downloads/mac-osx/ and select a version (like Python 2.7.18), preferably a 64-bit installer
Download it and open (both .dmg
and .pkg
files shouldn't require commands from the user to install)
Follow installation steps
pip should be already installed in case one of Python 2 >=2.7.9 or Python 3 >=3.4 versions is installed
Check if pip is installed with pip -V
or pip3 -V
To install pip, open Terminal and download a file get-pip.py
as follows :
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
After downloading, run following command from the directory where it is downloaded
python get-pip.py
pip works with Python versions 2.7, 3.5, 3.6, 3.7, 3.8 and also PyPy
Above commands were taken from Pip website
Following command can be used to upgrade pip
pip install -U pip
Check if python is installed with python -V
or python3 -V
In case not installed or to install a different version :
Go to official Python website https://www.python.org and hover over Downloads tab to get download link for a recent stable version
Go to https://www.python.org/downloads/windows/ to get Python 2.7 or an older version
Download and double-click the file to install
After installing, open Run using the βwindows key + rβ keyboard shortcut and type cmd
and press enter to open command prompt
Check for python version with command python -V
or python3 -V
In case python command is not found, follow following steps to add Python to system PATH
System PATH is an environment variable which contains a list of paths (or locations like C:\Windows
This is used by the Command Prompt and number of other programs running in the System, to find for libraries or executables (like Python)
If the location of folder containg Python.exe is present in PATH, then Python can be run from the command prompt without requiring to enter full path
For Python 2.7 versions, add the following directories to PATH:
C:\Python27\
C:\Python27\Scripts\
C:\PYTHON27\DLLs\
C:\PYTHON27\LIB\
For Python 3.5+ versions, add the following directories to PATH:
C:\Python27\
C:\Python27\Scripts\
C:\PYTHON27\DLLs\
C:\PYTHON27\LIB\
pip should be already installed in case one of Python 2 >=2.7.9 or Python 3 >=3.4 versions is installed
Check if pip is installed with pip -V
or pip3 -V
commands in Command Prompt
To install pip, open Terminal and download a file get-pip.py
with following command :
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
After downloading, run following command from the directory where it is downloaded
python get-pip.py
pip works with Python versions 2.7, 3.5, 3.6, 3.7, 3.8 and also PyPy
Above commands were taken from pip website
Following command can be used to upgrade pip in windows
python -m pip install -U pip
Or for python 3 :
python3 -m pip install -U pip