How to Install pip on CentOS, Ubuntu, and Windows
Install and verify pip on CentOS, Ubuntu, and Windows, then fix PATH, repository, virtual-environment, and ensurepip errors.

Use the interpreter-qualified command first: run python3 -m pip --version on CentOS or Ubuntu, or py -m pip --version on Windows. These commands prove which Python installation owns pip and avoid PATH mismatches.
# CentOS or Ubuntu
python3 -m pip --version
# Windows PowerShell or Command Prompt
py -m pip --version
If the command works, pip is installed. For application development, create a virtual environment before installing project packages. The procedures below cover package-manager installation, bootstrapping with ensurepip, CentOS repository differences, Windows PATH problems, and common errors.
Install pip on Ubuntu
The documented Debian/Ubuntu route is to refresh package metadata and install both pip and the virtual-environment package:

sudo apt update
sudo apt install python3-venv python3-pip
Verify the installation with the same interpreter-qualified command:
python3 -m pip --version
The output should include a pip version and the Python installation path. Ubuntu may provide more than one Python version, so use the command that matches the interpreter you will run in production.
Set up an Ubuntu project environment
mkdir my-project
cd my-project
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip
After activation, your shell prompt normally shows (.venv). Install application dependencies into this environment:
python3 -m pip install requests
python3 -m pip freeze > requirements.txt
Leave the environment with:
deactivate
Install pip on CentOS or RHEL
CentOS and RHEL releases differ in their repositories and package-manager commands. The Python Packaging User Guide states that CentOS and RHEL do not provide pip or wheel in their core repositories. Identify the exact release first, then use the repository instructions for that release.
CentOS Stream, RHEL 8, and newer dnf-based systems
Enable the appropriate EPEL repository for your release, then install the distribution packages. A common dnf-based sequence is:
# Enable the EPEL repository appropriate for your release.
# The exact URL and package name vary by CentOS/RHEL version.
sudo dnf install epel-release
sudo dnf install python3-pip python3-wheel
Some RHEL installations require an administrator to enable repositories through the subscription tools instead of installing epel-release. If that package is unavailable, consult the repository guidance for the exact release rather than mixing packages from another version.
python3 -m pip --version
CentOS 7 or RHEL 7
Older systems commonly use yum, and available Python package names differ. The packaging guide records python34u and python34u-wheel as a CentOS 7/RHEL 7 parallel-install example:
sudo yum install python34u python34u-wheel
python3 -m pip --version
That example is release-specific. Do not assume the package exists on CentOS Stream, RHEL 8, or RHEL 9. Check the enabled repositories and the Python executable supplied by your operating system.
Create a CentOS virtual environment
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip
If venv is missing, install the matching operating-system package (often named python3-venv or included with the Python package set for that release), then rerun the command.
Install pip on Windows
The standard Python installer for Windows normally includes pip. Open PowerShell or Command Prompt and verify it:
py -m pip --version
If pip is absent, bootstrap it with Python’s built-in ensurepip module:
py -m ensurepip --default-pip
py -m pip install --upgrade pip
Use the Python launcher (py) instead of a bare pip command so the package is installed for the interpreter you selected.
Create and activate a Windows project environment
mkdir my-project
cd my-project
py -m venv .venv
.venv\Scripts\activate
py -m pip install --upgrade pip
In PowerShell, an execution-policy error can prevent activation. You can either activate from Command Prompt with .venv\Scripts\activate.bat or adjust your user-level PowerShell policy according to your organization’s rules. You can also skip activation and invoke the environment’s interpreter directly:
.venv\Scripts\python.exe -m pip install requests
Choose the right installation method
| Situation | Recommended command | Why |
|---|---|---|
| Ubuntu system integration | sudo apt install python3-venv python3-pip |
Uses Ubuntu’s package manager and repository metadata. |
| CentOS/RHEL system integration | sudo dnf install python3-pip python3-wheel after enabling the correct repository |
Uses release-compatible distribution packages. |
| Windows standard installation | py -m pip --version |
Windows Python installers normally include pip. |
| pip missing from an existing Python install | python3 -m ensurepip --default-pip or py -m ensurepip --default-pip |
Bootstraps pip with Python’s bundled module. |
| Project dependencies | python3 -m venv .venv or py -m venv .venv |
Prevents project packages from changing the system Python. |
Always bind pip to its interpreter: python3 -m pip, python -m pip, or py -m pip. A bare pip executable can point to a different Python installation.
Fallback: use ensurepip or get-pip.py
ensurepip is the first fallback because it is included with Python:
python3 -m ensurepip --default-pip
python3 -m pip --version
On Windows, use py -m ensurepip --default-pip. If the module is unavailable or your Python build omits it, the Python Packaging User Guide documents downloading get-pip.py securely and running it with the intended interpreter:
python3 get-pip.py
Use this only as a fallback. The guide warns that get-pip.py does not coordinate with an operating-system or other package manager and can leave a system inconsistent. Do not combine it casually with apt, dnf, or yum-managed Python packages.
Install packages safely after pip is available
- Create a virtual environment for each application.
- Activate it, or call its Python executable directly.
- Upgrade pip inside that environment.
- Install only the dependencies needed by the project.
- Record exact or bounded versions in
requirements.txtor your project metadata.
# Linux
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
# Windows
py -m venv .venv
.venv\Scripts\activate
py -m pip install --upgrade pip
py -m pip install -r requirements.txt
Inside a virtual environment, ordinary installs should not need sudo or Administrator privileges. Use elevated privileges only for the operating-system package-manager step when system integration is intentional.
Troubleshooting
pip: command not found or pip is not recognized
Cause: pip is not on PATH, or it belongs to another Python installation.
Fix: run python3 -m pip --version on Linux or py -m pip --version on Windows. If that succeeds, continue using the qualified form. If it fails, install pip with the platform procedure or bootstrap it with ensurepip.
No module named pip
Cause: the selected interpreter has no pip module.
Fix: install the matching OS package, or run python3 -m ensurepip --default-pip (or py -m ensurepip --default-pip on Windows). Then verify with the same interpreter.
Ubuntu reports an externally managed environment
Cause: the distribution protects its system Python from direct package changes.
Fix: create a virtual environment with python3 -m venv .venv and install inside it. Use apt for distribution-owned system packages.
CentOS cannot find python3-pip
Cause: pip is not in the enabled core repositories for that release.
Fix: identify the CentOS/RHEL version, enable the compatible EPEL or vendor repository, and install the package with that release’s dnf/yum instructions. Do not install a package built for a different release.
Permission denied during installation
Cause: pip is trying to write into a system directory.
Fix: use a virtual environment. If you intentionally need a per-user install outside a venv, review your platform’s user-install behavior; avoid using sudo pip because it can conflict with the OS package manager.
Windows activation is blocked
Cause: PowerShell execution policy prevents the activation script from running.
Fix: use Command Prompt’s .venv\Scripts\activate.bat, invoke .venv\Scripts\python.exe -m pip directly, or follow your organization’s approved PowerShell policy.
pip installs into the wrong Python
Cause: multiple Python versions are installed.
Fix: compare python3 --version and python3 -m pip --version (or py --list and py -m pip --version on Windows). Use the full interpreter path or a version-selected launcher command when necessary.
Performance, reliability, and cost considerations
- Performance: package installation time depends on download size, network speed, dependency resolution, and whether a wheel is available. Wheels usually avoid local compilation.
- Reliability: use the OS package manager for system Python and virtual environments for applications. Keep a lock or requirements file so a rebuild uses known dependencies.
- Privileges: avoiding root installs reduces the chance of breaking distribution-managed files.
- Network and storage: pip downloads packages and may cache them locally. In CI, cache deliberately and invalidate the cache when Python versions or dependency constraints change.
- Cost: pip itself has no license fee. Package downloads consume network bandwidth and build time; private indexes or hosted CI may have their own charges.

Or skip the browser setup
If you need screenshots for documentation or automation after setting up Python, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF output. See the ScreenshotNeo API documentation for all options.
# cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
# Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
// Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Cookie banners, newsletter popups, and chat widgets are removed before the shot. Bot checks, blank pages, failed loads, timeouts, and cache hits are never billed, and response headers identify the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
FAQ
Does Python on Windows include pip?
Normally yes. Confirm with py -m pip --version; if it is missing, run py -m ensurepip --default-pip.
Should I use pip or python -m pip?
Use the interpreter-qualified form. It guarantees that pip belongs to the Python interpreter you intend to use.
Can I install pip without root on Linux?
Yes. Create a virtual environment in a directory you own and install there. Root is normally needed only for apt, dnf, or yum system packages.
Why does CentOS need EPEL?
CentOS and RHEL do not provide pip or wheel in their core repositories, so an additional compatible repository may be required.
When should I use get-pip.py?
Use it only when the package-manager and ensurepip routes are unavailable. It can conflict with OS-managed Python packages.


