1. Home
  2. Languages
  3. Python
  4. A Beginner’s Guide to Python’s pip install Command

A Beginner’s Guide to Python’s pip install Command

Certainly! Here’s a detailed step-by-step guide to fixing common issues with Python’s pip install command, designed specifically for beginners.


Python’s pip is the package installer for Python. It allows you to install and manage additional libraries and dependencies that are not distributed as part of the standard library. However, beginners often encounter problems running pip install. This guide will help you troubleshoot and fix common issues.


Step 1: Verify Python and pip Installation

Why?

Before installing any packages, ensure Python and pip are properly installed and working.

How?

  1. Open a terminal (Command Prompt on Windows, Terminal on macOS/Linux).
  2. Check Python version:

    python –version

    or sometimes

    python3 –version

  3. Check pip version:

    pip –version

    or

    pip3 –version

What should happen?

  • You should see the version numbers printed out.
  • If you get an error like 'python' is not recognized, Python is not installed or not added to the PATH.


Step 2: Add Python and pip to PATH (Windows Specific)

Why?

Windows needs PATH environment variables updated for the system to recognize python and pip commands.

How?

  1. Find where Python is installed (e.g., C:\Users\YourName\AppData\Local\Programs\Python\Python39).
  2. Search Environment Variables in the Windows Search.
  3. Click Environment Variables > under System Variables, find and select Path > Edit.
  4. Add the following two entries (adjust paths to your install):

    • C:\Users\YourName\AppData\Local\Programs\Python\Python39\
    • C:\Users\YourName\AppData\Local\Programs\Python\Python39\Scripts\
  5. Click OK, restart your terminal, then try pip --version again.


Step 3: Upgrade pip

Why?

An outdated pip can cause installation failures.

How?

Run the following command:

python -m pip install –upgrade pip

or if your system uses python3:

python3 -m pip install –upgrade pip

After upgrading, verify the new version with pip --version.


Step 4: Use the Correct pip for Your Python Version

Why?

You might have multiple Python versions installed. pip might be linked to the wrong Python interpreter.

How?

Run pip using the Python interpreter explicitly:

python -m pip install package_name

or for Python 3 specifically:

python3 -m pip install package_name

Replace package_name with the actual library you want to install.


Step 5: Check Internet Connection and Proxy Settings

Why?

pip install downloads packages from the internet. If there is no internet or a restrictive proxy, installation fails.

How?

  • Make sure you are connected to the internet.
  • If behind a proxy, configure pip:

pip install package_name –proxy http://user:password@proxyaddress:port

Or set environment variables for proxy:


Step 6: Use Virtual Environments

Why?

Virtual environments prevent conflicts between package versions and permissions.

How?

  1. Create a virtual environment:

python -m venv myenv

Replace myenv with the name of your environment.

  1. Activate it:

  • Windows:

    myenv\Scripts\activate

  • macOS/Linux:

    source myenv/bin/activate

  1. Now, install packages inside this isolated environment:

pip install package_name


Step 7: Check for Permissions and Use Administrator/Sudo if Needed

Why?

Sometimes pip install can fail due to lack of permission to install packages globally.

How?

  • On Windows, run Command Prompt as Administrator.
  • On macOS/Linux, prepend your command with sudo:

sudo python3 -m pip install package_name

Note: Using virtual environments is preferred over global installs with sudo.


Step 8: Fix SSL Certificate Issues (Common on macOS)

Problem:

You might get SSL errors like SSL: CERTIFICATE_VERIFY_FAILED.

Solution:

  1. For macOS users using Python installed from python.org:
    Run the Install Certificates.command script located in:

/Applications/Python 3.x/

  1. Alternatively, upgrade certifi package:

pip install –upgrade certifi


Step 9: Debugging Specific Package Installation Issues

If a specific package fails, the error message often tells you what’s wrong:

  • Missing compiler or build tools (like gcc or build-essential).
  • Missing dependencies (libraries like libxml2, libffi, etc.)

How to fix:

  1. Read the error message carefully.
  2. Search online for the error message.
  3. Install necessary build tools.

For Ubuntu/Debian:

sudo apt-get install build-essential libssl-dev libffi-dev python3-dev

For Windows:


Step 10: Reinstall pip

Why?

pip itself may be corrupted.

How?

Download get-pip.py from https://bootstrap.pypa.io/get-pip.py

Run:

python get-pip.py

This reinstalls or upgrades pip.


Bonus Tips

  • Check package name spelling.
  • Sometimes the package version is not available. Specify version like:

pip install package_name==1.0.0

  • To see detailed output for debugging:

pip install package_name –verbose


Task Command
Check Python version python --version or python3 --version
Check pip version pip --version or pip3 --version
Upgrade pip python -m pip install --upgrade pip
Install package python -m pip install package_name
Create virtual environment python -m venv envname
Activate virtual environment Windows: envname\Scripts\activate
macOS/Linux: source envname/bin/activate
Install build tools (Ubuntu) sudo apt-get install build-essential python3-dev
Reinstall pip Download get-pip.py and run python get-pip.py


By following these steps carefully, you should be able to fix most common problems encountered with Python’s pip install command.

If you want, I can help troubleshoot a specific error message you’re seeing — just share it!

Updated on June 3, 2025
Was this article helpful?

Related Articles

Leave a Comment