Python versions in Ubuntu

Ubuntu comes with both python versions 2.x and 3.x.
The default python version in ubuntu is 2.x

The python versions installed in ubuntu can be found using the below commands:
For both cases, to get out from Python shell, write:

 exit()

For installing python modules in python 2.x in ubuntu, use  :

pip

For installing python modules in python 3.x in ubuntu, use:

 pip3

Update setuptools in python

If package installation returns the following error:

python setup.py egg_info" failed with error code 1 in /tmp/xyz moduleName/

Use the below command to get the things working:

pip install --upgrade setuptools --user python

Using the --user python flag will resolve the error in --upgrade flag .

If you are using python3:

pip3 install --upgrade setuptools --user python