Installing new package in python using pip
The pip module is part of python installation (Python 2.7.9 and later + Python 3.4 and later). However in some Python installation it may not be installed. In any case it can always be installed through the easy_install module. Simply run $ easy_install --user pip
$ easy_install --user pip3
# apt install python-pip
# apt install python3-pip
$ python -m pip
We can search packages with pip, for example you we may look for jupyter package by running
$ python -m pip search jupyter
$ python -m pip --user install jupyter
$ python -m pip --user show jupyter
$ python -m pip list --user
$ python -m pip list --outdate --user
$ python -m pip install --user --upgrade foo
$ python -m pip --user uninstall foo
$ python -m pip --user install ipython
$ $HOME/.local/bin/ipython
Virtual Environment: Using vitualenv and venv
A virtual environment helps in isolating global installed libraries from virtal environment installation. It can serve as a "sandbox" allowing us to to install external libraries or packages that differ in version from our globally installed libraries. This may be helpful when Python program needs an older library version to run or when we don't want to clutter our Python installation with to many libraries.
Python 3.3 (and above) added the venv package to the standard library, so we can use it to create virtual environment without installing third party package such as virtualenv. However in Python 2.7 we still need to instlal virtualenv package, to do this we simply run:
$ python2.7 -m pip install --user virtualenv
$ python2.7 -m virtualenv VNEW
$ python -m venv VNEW
$ source ./VNEW/bin/activate
$ source VNEW/bin/activate
(VNEW) $
$ source VNEW/bin/activate
(VNEW) $ deactivate
$