Python’s package manager is called pip
, and it comes bundled with every recent version of Python. pip
allows us to install packages that don’t come bundled with the Python standard library.
By default, pip
searches what’s called PyPI, or the Python Package Index. This public repository contains thousands of packages written by the Python community.
This lesson shows you how to use pip
to download the requests
package from PyPI. This package allows you to conveniently send HTTP requests with Python:
import requests
url = 'https://www.google.com'
response = requests.get(url)
print(f'Response returned: {response.status_code}, {response.reason}')
print(response.text[:200])
Packages can be installed with pip install
. To view a full listing of commands, run pip help
.
kethan on Sept. 19, 2020
pip
command is not installed in Python