Skip to Content

7 Python Pip Command Examples

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 install Pip on Linux?
  • How to install & remove a python package with Pip
  • Install a python package with a specific version
  • Install a python package from a specific repo

How to install Pip on Linux?

First, we need to download pip installer – wget https://bootstrap.pypa.io/get-pip.py or curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Second, we need to 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

Get Your Free Linux training!

Join our free Linux training and discover the power of open-source technology. Enhance your skills and boost your career! Learn Linux for Free!

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

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 with pip

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

Upgrade a package with pip

$ pip install –upgrade SomePackage
[…] Found existing installation: SomePackage 1.0

Uninstall a package with pip

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

Install a python package 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 with pip

Install from specific repo

  • $ pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple
  • -i, –index-url default is (https://pypi.python.org/simple). This should point to a repository

Linux Troubleshooting Guide:

Linux Learning Guide: