For Windows 10/8/7:

  1. Open System Properties (Right click Computer in the start menu, or use the keyboard shortcut Win+Pause)
  2. Click Advanced system settings in the sidebar.
  3. Click Environment Variables...
  4. Select PATH in the System variables section
  5. Click Edit
  6. Add Python's path to the end of the list (the paths are separated by semicolons). For example:

    C:\Windows;C:\Windows\System32;C:\Python27
    

For Windows XP:

  1. Open System Properties (Type it in the start menu, or use the keyboard shortcut Win+Pause)
  2. Switch to the Advanced tab
  3. Click Environment Variables...
  4. Select PATH in the System variables section
  5. Click Edit
  6. Add Python's path to the end of the list (the paths are separated by semicolons). For example:

    C:\Windows;C:\Windows\System32;C:\Python27
    
  7. Test on a new terminal window or if using an integrated terminal within a text editor, close and restart your editor or the changes won't be applied.

Answer from Michael Mrozek on Stack Exchange
🌐
YouTube
youtube.com › artur spirin
How to add Python Path to Environment Variables in Windows 10 - YouTube
This video will show you how to set Windows 10 environment variables for Python. You can use this method to set Environment variables not just for Python but...
Published: January 14, 2016
Views: 397K
Discussions

python - How to add to the PYTHONPATH in Windows, so it finds my modules/packages? - Stack Overflow
The question isn't about the PATH that DOS uses to find commands, but the Python path, i.e. sys.path in Python. In most operating systems, Python just uses the system environment variable PYTHONPATH, but Windows seems to be 'special'. 2019-10-16T16:39:29.523Z+00:00 More on stackoverflow.com
🌐 stackoverflow.com
Python and the PATH variable in Windows 10
If you type python and the store opens, Turn off the python alias in the Alias List in settings ( https://www.tenforums.com/tutorials/102096-manage-app-execution-aliases-windows-10-a.html ) More on reddit.com
🌐 r/Python
16
33
August 20, 2021
command line - How to set a environment variable for a python script on windows10? - Stack Overflow
Now I am running the python file everytime like this: python C:/my/path/to/python/file.py I want to replace it with one word command like this myfile The same command should work from command_prompt, More on stackoverflow.com
🌐 stackoverflow.com
How to add Anaconda to path AFTER installation? (Windows 10)

Look at the example of what else is in your path statement. You don't include the exe name there, just the path to it.

More on reddit.com
🌐 r/learnpython
8
20
November 11, 2017
🌐
Python
docs.python.org › 3 › using › windows.html
4. Using Python on Windows — Python 3.15.2 documentation
It is intended to catch accidental uses of the typical POSIX command on Windows, but is not meant to be widely used or recommended. To launch your default runtime, run python or py with the arguments you want to be passed to the runtime (such as script files or the module to launch): $> py ... $> python my-script.py ... $> py -m this ... The default runtime can be overridden with the PYTHON_MANAGER_DEFAULT environment variable, or a configuration file. See Configuration for information about configuration settings.
🌐
YouTube
youtube.com › ghost together
How to add python to environment variables on windows 10/11 - YouTube
#python #windows #windows10 #windows11 how to add python to environment variables on windows 10 or windows 11Timestamps:00:00 Go to Start Button00:06 Type en...
Published: July 5, 2023
Views: 10K
🌐
Liquid Web
liquidweb.com › home › help docs › server administration › windows server administration › adding python path to windows 10 or 11 path environment variable
Adding Python Path to Windows 10 or 11 PATH Environment Variable | Liquid Web
December 15, 2025 - Type in the following and press Enter. ... In the System Properties window, go to the Advanced tab, clicking the Environment Variables button. Create a user variable by clicking the New button under the User Variables for Administrators section.
🌐
Data to Fish
datatofish.com › add-python-to-windows-path
How to Add Python to Windows PATH
That should open the Environment Variables window, where you can add/edit your paths. ... Click on New... if no Path variable is present, Otherwise select the Path variable and then click on Edit… instead. You should then see the New User Variable box. Type Path in the Variable name field. For the Variable value you will need to know the path to the Python that is installed on your computer.
🌐
YouTube
youtube.com › watch
Configure environment variables for Python on Windows 10 - YouTube
For quick itversity updates, subscribe to our newsletter or follow us on social platforms.* Newsletter: http://notifyme.itversity.com* LinkedIn: https://www....
Published: December 29, 2017
Find elsewhere
🌐
YouTube
youtube.com › learninglad
How to Add Python Installation to Path Environment variable in Windows 10 - YouTube
In this tutorial you will learn How to Add Python Installation to Path Environment variable in Windows 10.When we install we have an option to set the path. ...
Published: November 24, 2020
Views: 157K
🌐
YouTube
youtube.com › the code city
Add Python to Path Environment Variable - Windows 10 - YouTube
In this tutorial, we will show you the process of adding Python to the Path variable in Windows 11 or Windows 10. By adding Python to the Path variable, you ...
Published: May 24, 2023
Views: 30K
🌐
YouTube
youtube.com › watch
How to set Python Path to Environment Variables in Windows 10 | Alok Tripathi - YouTube
This video shows you how to add the environment path variable of python in Windows 10.Please follow the steps as shown in the video.Follow me:Github: https:/...
Published: September 19, 2017
🌐
Reddit
reddit.com › r/python › python and the path variable in windows 10
r/Python on Reddit: Python and the PATH variable in Windows 10
August 20, 2021 -

Do you remember checking the box in the image shown below to add your Python installation to PATH in Windows 10?

Adding Python to PATH

Well, I was curious! What if someone accidentally forgot to check that little radio button? What would be the possible recovery steps?

So I spent my evening yesterday uninstalling Python and re-installing to figure out a way to add Python to the PATH post-installation.

If you forget to add Python to the PATH variable, you won't be able to run Python in your command line.

You will get a message saying,

‘python' is not recognized as an internal or external command.

Here are the steps I used to add Python to the PATH variable in Windows 10.

  1. Copy the directory to which Python is being installed.

  2. Search for System Properties in the Search Bar.

  3. Click on the "Environment Variables" button in System Properties.

  4. Click on the "Path" variable and then click on "Edit".

  5. Now here's the deal. Paste the directory path from Step 1 at the top of the list. You can use the "Move up" button to get it to the top. Now click on "Ok".

I found out that if you paste the path at the end, it still doesn't work. Can someone tell me why?

Anyways, if the steps are not clear to anyone, here is a visual guide containing images of every step, on my blog for achieving the above objective. If you are interested, do take a look.

🌐
Medium
medium.com › @pies052022 › how-to-setup-python-environment-variables-in-windows-10-9cacdff12e56
How to Setup Python Environment Variables in Windows 10? | by JOKEN VILLANUEVA | Medium
October 7, 2025 - Additionally, you may check the Add Python 3.10 to path check box to include the interpreter in the execution path. Select “Customize Installation” to continue. By selecting the checkboxes below you will be redirected to the Optional Features: Select Next. You will see Advanced Options and select the Install for all users and Add Python to environment variables checkboxes. Click Install to start the installation. After the installation, you’ll see a Python Setup successful
🌐
AccuWeb Hosting
manage.accuwebhosting.com › portal home › knowledgebase › windows vps hosting › how to add python path to windows environment variables?
How to Add Python Path to Windows Environment Variables? - AccuWebHosting
March 28, 2025 - Achieving this requires adding the Windows 10 or 11 PATH environment variable, allowing your system to recognize and execute Python commands without caring for the current directory. The PATH environment variable is a system setting that informs Windows where to search for executable programs ...
Top answer
1 of 2
1

If you made the python an exe and cd into the directory or add it to your environment variables you could call it by myfile or myfile.exe

Another way would be to make a batch file that contains

python C:/my/path/to/python/file.py

and name it myfile which would allow you to call the batch file and it would type out the rest

Also if you cd into C:/my/path/to/python you could type python file.py instead of the whole path.

2 of 2
1

You can basically create Custom Environment Variables. This link will guide how can you do that.

Link: Create Custom Environment Variables in Windows

The file option is interesting because it means you can also create an environment variable to launch a program. For example, you can point an environment variable to any EXE file on your system. When you invoke the variable, it will launch the program. If you have a custom executable program file stored in some random directory on your PC, this is an easy way to launch it without having to go look for it.

Or if you want to run your python script from anywhere, technically not anywhere but from other directory also then you can create a .bat file. And opening that .bat will automatically run your python script. You can create a .bat by :

  1. Right click create a new file. Name it as script.bat.
  2. Right click on script.bat and open it in Notepad.
  3. Copy/paste this script python C:/my/path/to/python/file.py
  4. Save it and run that script.bat. It will automatically run you file.py from here. You can place script.bat in your preferred place like in desktop.
🌐
Educative
educative.io › answers › how-to-add-python-to-path-variable-in-windows
How to add Python to PATH variable in Windows
A typical installation would have the following path, C:\Users\MyUserName\AppData\Local\Programs\Python\Python310 · Now, we will need to add this to the PATH variable, we right click on "This PC" and go to "Properties".
🌐
Itsourcecode
itsourcecode.com › home › how to setup python environment variables in windows 10
How to Setup Python Environment Variables In Windows 10
July 11, 2026 - Additionally, you may check the Add Python 3.10 to path check box to include the interpreter in the execution path. Select “Customize Installation” to continue. By selecting the checkboxes below you will be redirected to the Optional Features: Select Next. You will see Advanced Options and select the Install for all users and Add Python to environment variables checkboxes. Click Install to start the installation. After the installation, you’ll see a Python Setup successful
🌐
Medium
medium.com › @sounder.rahul › configuring-environment-variable-path-for-python-on-windows-128cb8feabb5
Configuring Environment Variable PATH for Python on Windows - Rahul Sounder - Medium
March 8, 2024 - Below is the Windows path where the Python 3.10 version is installed · Press enter or click to view image in full size · Go to the system environment variable in the Windows search · Press enter or click to view image in full size · Click ...
🌐
Python
docs.python.org › 2 › using › windows.html
3. Using Python on Windows — Python 2.7.18 documentation
In order to run Python flawlessly, ... (following guide applies to XP classical view): Right-click the icon for your machine (usually located on your Desktop and called “My Computer”) and choose Properties there....
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-add-python-to-windows-path
How to add Python to Windows PATH? - GeeksforGeeks
July 12, 2025 - Click on open file location and you will be in a location where Python is installed, Copy the location path from the top by clicking over it. Now, we have to add the above-copied path as a variable so that windows can recognize. Search for "Environmental Variables", you will see something like this: