[python, pip, packages, selenium]


Overview

Python packages are collections of modules and functions that provide additional functionalities beyond the standard library. They enable developers to extend Python’s capabilities easily with pre-written code for specific tasks, such as data analysis, web development, machine learning, and more. This guide will teach you how to install and update Python packages.

Installing Python packages

The Anaconda Python Distribution includes many of the packages we need for scientific computing. If you’re interested in all the included packages, click here and select the Python 3.x tab.

However, you may come across packages that are not installed by default. In such cases, we recommend using the pip package management tool to install them.

Warning

If you verified your Python installation in the setup process using python3 --version, use pip3 instead of pip for all the following commands.

The installation steps

First, update pip by typing the following command in the terminal:

pip install --upgrade pip

If you get an error, try the following command instead:

python -m pip install --upgrade pip

To build your web scraping toolkit, you will need the selenium package. Start by installing a dependency:

pip install msgpack

Next, install selenium by entering:

pip install selenium

pip will install the requested package and any necessary dependencies. If this succeeded, the last line displayed will be:

Successfully installed selenium-4.x.0

Updating packages

To update an already installed package on your system, use the following command in your terminal:

pip install --upgrade selenium
Tip

No administrator rights?

If you do not have administrator rights on the computer you are using, install packages only for your account. You can do this by typing pip install --user packagename, e.g., pip install --user selenium.