To install PIP (Python’s package installer) on Windows, follow these steps:
Step-by-Step Guide:
1. Check if Python is Already Installed
PIP is bundled with Python (starting from version 3.4). First, check if Python is installed on your system.
- Open Command Prompt (press
Win + R
, typecmd
, and hit Enter). - Type the following command to check the Python version:
or
- If you see the version (e.g., Python 3.9.x), Python is installed. Otherwise, you need to install Python first.
2. Download and Install Python (if not installed)
- Visit the official Python website: https://www.python.org/downloads/.
- Download the latest version of Python for Windows.
- During installation, ensure you check the box that says “Add Python to PATH” at the beginning of the setup wizard.
- Click Install Now and follow the on-screen instructions.
3. Verify PIP Installation
- Once Python is installed, PIP should also be installed by default (Python 3.4+).
- To verify that PIP is installed, open Command Prompt again and run:
or
If you see something like
pip 21.x from ...
, PIP is already installed and you can start using it to install Python packages.
4. Manually Install PIP (if not installed)
If PIP is not installed automatically or you are using an older version of Python, you can manually install it.
- Download
get-pip.py
:- Open your web browser and go to the following URL: https://bootstrap.pypa.io/get-pip.py.
- Right-click on the page and Save As to download the
get-pip.py
file.
- Run
get-pip.py
:- Open Command Prompt.
- Navigate to the directory where
get-pip.py
is downloaded. For example, if it’s in your Downloads folder: - Run the following command to install PIP:
- This should install PIP on your system. After the installation is complete, verify it by running:
5. Update PIP (Optional)
If you already have PIP installed but want to make sure it’s up to date, you can update it with the following command:
Troubleshooting:
- Python not found in PATH: If you get an error saying
python is not recognized
, it means Python might not be added to your system’s PATH variable. Reinstall Python and make sure to select the “Add Python to PATH” option. - Permission Issues: If you encounter permission errors, try running the Command Prompt as Administrator (right-click the Command Prompt icon and select Run as administrator).
Conclusion:
Once you’ve installed Python and PIP, you can easily install Python packages by running commands like:
For example, to install requests
:
This makes managing Python packages on Windows straightforward and efficient!