欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

How to install pip on Ubuntu 16.04 ?

程序员文章站 2022-07-12 11:19:54
...

How to install pip on Ubuntu 16.04 ?

如何在 Ubuntu 16.04 系统上安装 pip ?

We’ll show you how to install pip on Ubuntu 16.04. Pip is a package management system used to install and manage software packages which are found in the Python Package Index (PyPI). These software packages are written in Python, and are typically used to extend or enhance a Python application. Pip is a widely-used Python package manager, known for it’s user-friendliness and performance. Pip also has a feature to manage full lists of packages and corresponding version numbers, made possible through a “requirements” file. Installing Pip on Ubuntu 16.04, is an easy task – just carefully follow the steps in this tutorial, and you should have Pip installed on Ubuntu 16.04 in less than 10 minutes.

1. Connect to SSH and Update your System Software
First of all, connect to your server via SSH and make sure that all your system software is up to date. Run the following command to update the package list and upgrade all of your system software to the latest version available:

sudo apt-get update && sudo apt-get -y upgrade

2. Install Pip on Ubuntu 16.04
Once the upgrade is completed, you can move on and install Pip onto your Ubuntu VPS. The installation of Pip is very simple, and is done through “apt-get”. The only thing you need to do is to run the following command:

sudo apt-get install python-pip

3. Verify the Pip Installation on Ubuntu
The apt package manager will install Pip and all the dependencies required for the software to work optimally. Once the installation is completed, you can verify that it was successful by using the following command:

pip -V

You should see an output similar to the following:
That means Pip has been successfully installed on your Ubuntu server and is ready to use.

Basic Pip Commands on Ubuntu

Now that you have installed Pip, below are some useful commands to help get you started with using Pip.

Search for a Package With Pip on Ubuntu

To search for a package, you can use the following command:

pip search package_name

Install a Package With Pip on Ubuntu

To install the package, you can use the following command:

pip install package_name

Uninstall a Package With Pip on Ubuntu

In the case where you’d like to uninstall a package, you can use the following command:

pip uninstall package_name

For more Pip options and usage examples you can use the –help flag:

pip --help

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output.
  --log                 Path to a verbose appending log.
  --proxy              Specify a proxy in the form [user:[email protected]]proxy.server:port.
  --retries          Maximum number of retries each connection should attempt (default 5 times).
  --timeout              Set the socket timeout (default 15 seconds).
  --exists-action     Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
  --trusted-host    Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert                Path to alternate CA bundle.
  --client-cert         Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
   ...

References
https://www.rosehosting.com/blog/how-to-install-pip-on-ubuntu-16-04/