Adding Python to your PATH environment variable allows you to run Python from any location on your computer without specifying the full path to the Python executable. Here's how to do it:
1. Find Your Python Installation Directory
-
Open File Explorer and navigate to your Python installation directory. The default location is usually:
- C:\Users\<your_username>\AppData\Local\Programs\Python\<version_number>
-
Note the path: You'll need this path for the next step.
2. Edit Environment Variables
- Right-click on This PC and select Properties.
- Click on Advanced system settings.
- In the System Properties window, click on Environment Variables.
- Under System variables, locate the Path variable and click Edit.
- Click New and paste the path to your Python installation directory.
- Repeat the process for the Scripts folder within your Python installation directory. This folder contains useful Python utilities.
- Example: C:\Users\<your_username>\AppData\Local\Programs\Python\<version_number>\Scripts
- Click OK on all open windows to save the changes.
3. Verify the Changes
- Open a new Command Prompt or PowerShell window.
- Type python --version and press Enter.
- If you see the installed Python version, you've successfully added Python to your PATH.
4. Restart Your Computer (Optional)
- It's recommended to restart your computer for the changes to take effect fully.
By adding Python to your PATH, you streamline using Python on your Windows 10 computer.