Learn Python Pip Quick Guide

Updated: Dec 31, 2020

Pip is the package installer for Python. We can use pip to install packages that are not distributed as part of the standard library from the Python Package Index and other indexes.


How To Use Python Pip
How To Use Python Pip
  1. How to install Pip on Linux?

  2. How to install & remove a python package with Pip

  3. Install a python packeage with specific version

  4. Install a python package from a specific repo


How to install Pip on Linux?

Prerequisite: Python must be installed.

  • Download pip installer wget https://bootstrap.pypa.io/get-pip.py or curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

  • run the following command in the folder where you have downloaded get-pip.py python get-pip.py

If some certificate issue comes then use: wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate

Go to download dir and run command python get-pip.py


How to install & remove a python package with Pip

Install a package from PyPI (default python index)

  • $ pip install SomePackage Successfully installed SomePackage

Show what files were installed:

  • $ pip show --files SomePackage Name: SomePackage Version: 1.0 Location: /my/env/lib/pythonx.x/site-packages Files: ../somepackage/__init__.py [...]

List what packages are outdated:

  • $ pip list --outdated SomePackage (Current: 1.0 Latest: 2.0)

Upgrade a package:

  • $ pip install --upgrade SomePackage [...] Found existing installation: SomePackage 1.0

Uninstall a package:

  • $ pip uninstall SomePackage Uninstalling SomePackage: /my/env/lib/pythonx.x/site-packages/somepackage Proceed (y/n)? y Successfully uninstalled SomePackage

Install a python packeage with specific version

$ pip install SomePackage # latest version

$ pip install SomePackage==1.0.4 # specific version

$ pip install SomePackage>=1.0.4' # minimum version


Install a python package from a specific repo

Install from specific repo

$ pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple

-i, --index-url <url> default is (https://pypi.python.org/simple). This should point to a repository



14 views

Join our newsletter. Get a free Linux account on Cloud.

Get a Free Cloud Server! 

We can use this cloud server to practice Linux commands. Never miss a post!

Thanks for submitting!