Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Getting Started with Pip and PyPI

Give Feedback

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.

pip list will show you a list of all the currently installed packages. pip show will show you more information about a package, including packages it requires (dependencies) as well as packages that require it (packages it is a dependency of).

The following command string can be used with conda to create a new, minimal virtual environment called web-parser:

$ conda create --name web-parser python --no-default-packages

You can also specify a custom python version:

$ conda create --name web-parser python=3.6 --no-default-packages

Comments & Discussion

Become a Member to join the conversation.