Reading layout

How to Install Python and Requests for Beginners

Starting your journey into automated data collection requires a reliable technical foundation. This guide walks absolute beginners through downloading, installing, and verifying Python alongside the requests HTTP library. As a foundational entry point for The Complete Guide to Python Web Scraping, you will learn OS-specific installation steps, command-line verification, and how to execute your first programmatic web request without encountering common setup errors.

Environment setup steps Install Python, create a virtual environment, pip install the libraries, then verify the installation. 1 · InstallPython + pip2 · Createpython -m venv3 · Install libspip install …4 · Verifypython --version
Four steps from a fresh machine to a working scraping environment.

1. Understanding System Requirements

Before installation, ensure your operating system — Windows 10/11, macOS 11+, or a current Ubuntu/Debian Linux release — meets the minimum requirements for Python 3.10+. You will need administrator privileges to modify system environment variables and access to a terminal or command prompt. Proper environment configuration is the first critical step in Setting Up Your Python Scraping Environment.

2. Installing Python on Your Operating System

Download the official installer from python.org. On Windows, check the Add Python to PATH box during setup to avoid command recognition issues. macOS users can use the official .pkg installer or Homebrew (brew install python3). Linux users should rely on their distribution's package manager:

sudo apt install python3 python3-pip   # Debian/Ubuntu

After installation, verify success in your terminal:

python3 --version
# Output: Python 3.13.x

On Windows, python --version (without the 3) is typically correct if you checked "Add Python to PATH" during installation.

3. Installing the Requests Library via pip

Python's built-in package manager, pip, handles third-party libraries efficiently. Install requests into your active virtual environment (see Setting Up Your Python Scraping Environment for environment setup):

pip install requests

pip automatically resolves and installs required dependencies: urllib3, certifi, charset-normalizer, and idna. Wait for the Successfully installed confirmation before proceeding.

4. Verifying Installation and Running a Test Script

Create a file named test_requests.py in your working directory and run a simple GET request against the public httpbin.org testing endpoint:

import requests

response = requests.get('https://httpbin.org/get')
print(f'Status Code: {response.status_code}')
print('Connection successful!')

Run it:

python3 test_requests.py

A 200 status code confirms that both Python and requests are correctly installed and able to communicate with external servers.

Common Installation Mistakes and Fixes

MistakeSolution
Skipping "Add Python to PATH" on WindowsRe-run the installer, select Modify, and ensure Add Python to PATH is checked. Alternatively, add the Python directory manually via System Properties → Environment Variables.
pip installs to the wrong Python versionUse python3 -m pip install requests instead of bare pip to guarantee the correct interpreter is targeted.
Installing packages globally without a virtual environmentAlways run python -m venv venv and activate it before running pip install. This prevents dependency conflicts across projects.

Frequently Asked Questions

Do I need to install Python before using the Requests library? Yes. requests is a third-party Python package that requires a working Python interpreter and pip to install and run.

Why does pip install requests fail with a permission error? This happens when attempting a global install without administrative rights. Use a virtual environment, or add the --user flag (pip install --user requests) to install into your local user directory.

How do I update Requests to the latest version? Run pip install --upgrade requests. Pip queries PyPI and replaces the installed version with the newest stable release.

Can I use Requests for scraping JavaScript-rendered websites? No — requests only fetches static HTML responses. For sites that load content dynamically via JavaScript, pair it with a headless browser like Playwright or Selenium after mastering basic HTTP requests.