To install packages using pip
in Python, you can use the following command in your terminal or command prompt:
For example, to install the popular requests
package:
You can also specify a particular version:
To install packages from a requirements file, use:
If you’re using Python 3 and pip
is not the default, use pip3
instead:
Ensure you have pip
installed by running pip --version
.