Arguably one of the easiest tools to use for installing and managing Python packages, Pip has earned its notoriety by the number of applications utilizing this tool. Fancied for its capabilities in handling binary packages over the easy_installed packages manager, Pip enables 3rd party package installations. Though Python does sometimes come with Pip as a default, this tutorial will show how to install, check its version as well as some basic commands for using Pip on Ubuntu 16.04.
- These instructions are intended for an Ubuntu 16.04 LTS server, and we are logged in as root.
- If you are using a different operating system, check out our other Pip installation guides.
Ensure that all packages are up-to-date. After running the command below, you’ll get an output of any packages getting their update.
Install Pip with cURL and Python. Downloading using the cURL command ensures the latest version of Pip.
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
Verifying the installation of Pip:
pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
Pip can install 3rd party packages like Django, Tensorflow, Numpy, Pandas and many more with the following command.
pip install <library_name>
Searching for Libraries
You can also search for other libraries in Python’s repository via command line. For our example let’s look for Django packages. The search command shows us an extensive list similar to the one below.
pip search django
django-bagou (0.1.0) - Django Websocket for Django
django-maro (0.0.2) - `django-maro` is utility for django.
django-hooked (0.1.7) - WebHooks for Django and Django Rest Framework.
django-ide (0.0.5) - A Django app to develop Django apps
django-mailwhimp (0.1) - django-mailwhimp integrates mailchimp into Django
django-six (1.0.4) - Django-six —— Django Compatibility Library
django-umanage (1.1.1) - Django user management app for django
django-nadmin (0.1.0) - django nadmin support django version 1.8 based on django-xadmin
diy-django (1.3.1) - diy-django
Uninstalling a Library
If you don’t need the library and your scripts use them you can uninstall easily with this command:
Installing Python Resources
Many times Python packages have a requirements.txt file, if you see this file, you can run this command to install all libraries in that package
pip install -r requirements.txt