I just started using Python. Just developed a script in Python. It’s fun. I use Ubuntu 16.04 (64-bit) and there was a older version of Python installed on my distro. Had a hard time upgrading it, so I decided to uninstall it and then install the latest version. So, here’s how to install the latest version of Pip (Python) on Ubuntu 16.04:
First of all, update your system
You should always keep your Ubuntu up-to-date with all its packages. To do so, run the following command:
sudo apt-get update && sudo apt-get -y upgrade
This will update everything on your Ubuntu.
Next, install Pip on your Ubuntu
The actual installation process is very simple. Only one command, which is:
sudo apt-get install python-pip
That’s it. Now the latest version of Pip is installed on your Ubuntu. The package manager will install Pip and all other dependencies, so you don’t have to worry about anything.
You can check which version of Python you have installed by executing:
An alternative method to apt-get for installing Pip on Ubuntu is using curl and Python.
How to install Pip on Ubuntu with curl and Python:
Using curl and Python to install Pip is also a simple process. First, run:
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
And that’s it.
How to install packages using Pip
Now that you have Pip installed on your Ubuntu, it’s time to install some packages. You can search for a package using:
pip search packageName
Of course, you should replace packageName and search for whatever package you want. This command will search PyPI for packages with the name you provide.
After you find your desired package, you can install it with:
pip install packageName
And similarly to installing it, you can uninstall it with:
pip uninstall packageName
pip --help will give you a list of useful commands you can run with pip and a brief explanation of those commands:
[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:passwd@]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.