Installing Python on Windows
If you don’t have any Python installed, first of grab and install it from the official site: python.org/downloads.
If you have more than one we will handle it. If you have issues with PATH\scripts we will handle as well below.
When installing Python packages, you’ll often see commands like pip, python -m pip, or py -m pip. Which one you use depends on your system.
On Windows,
pyis the Python Launcher (included with official installers). It finds all installed versions and ensures packages install into the right place.
List installed versions:
py --listRun with your default version:
py -m pip install <package>Target a specific version:
py -3.11 -m pip install <package>Change default version:
py -3.11(Once run, this will become your default interpreter for py commands).
This makes py the most robust way to manage packages across versions.
This is sort of Windows specific Python alternative for Linux/Ubuntu
update-alternatives.It is used to set and switch defaults system-wide.
List available Python versions:
sudo update-alternatives --list python3Switch default version:
sudo update-alternatives - config python3(You’ll see a numbered menu to pick 3.11, 3.12, etc.)
Another tool that you may be familiar with is
nvm-windows. It is Node.js version manage. You can easily switch Node’s version on Windows with it.
- Open cmd (not WSL2!) and type:
py -m pip install --upgrade pipIf you see see
WARNING: The scripts pip.exe, pip3.13.exe and pip3.exe are installed in 'C:\Program Files\Python\Scripts' which is not on PATH.You should add “C:\Program Files\Python\Scripts” to Environment variables.
Best practice will be to add also “C:\Program Files\Python” (for python.exe) and “%USERPROFILE%\AppData\Local\Programs\Python\Launcher\” (for py.exe).
Step 1: Copy the Path
Copy this path from the warning message:
C:\Program Files\Python\Scripts
Step 2: Open Environment Variables
Press the Windows Key, type env, and click on “Edit the system environment variables”.
In the window that opens, click the “Environment Variables…” button.
Step 3: Edit your User Path
In the top section (“User variables for…”), select the Path variable.
Click the “Edit…” button.
Click “New”.
Paste the path you copied in Step 1.
Click “OK” on all three windows to close and save.
Step 4: Restart Your Command Prompt
This is critical. You must close your current CMD window and open a new one for the changes to take effect.
Now you can run command such as
python -m pip install <some_package>or write your own code without any issue.
