You know what has worked for me really well on windows.

My Computer > Properties > Advanced System Settings > Environment Variables >

Just add the path as C:\Python27 (or wherever you installed python)

OR

Then under system variables I create a new Variable called PythonPath. In this variable I have C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\other-folders-on-the-path

This is the best way that has worked for me which I hadn't found in any of the docs offered.

EDIT: For those who are not able to get it, Please add

C:\Python27;

along with it. Else it will never work.

Answer from darren on Stack Overflow
Discussions

Adding Python to PATH on Windows - Stack Overflow
I've been trying to add the Python path to the command line on Windows, yet no matter the method I try, nothing seems to work. I've used the set command, I've tried adding it through the Edit Environment Variables prompt, etc. More on stackoverflow.com
🌐 stackoverflow.com
How to add python to path and how to use it in commandline/powershell?
Images are banned so you post code blocks instead of screenshots/picture of your code, I'm assuming. It's much easier to diagnose and troubleshoot from a code block than a picture. More on reddit.com
🌐 r/learnpython
17
2
October 25, 2025
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
The absolute maze that is installing python and path variables
The official python (python.org) on Windows? The modern standard install on Windows does not use PATH at all anymore. Anyone telling you to use that is trying to make the modern install backwards compatible with the old-school way of doing things. Instead, python comes with the " python launcher ", which is the command "py". To run a file: py myfile.py To install a module: py -m pip install Etc. py is automatically associated with .py and .pyw files, so you can just doubleclick them to run as well. BUT WAIT, THERE'S A CATCH! The normal, proper way to develop python code is to make an isolated virtual environment for each project. If you do this it will activeate the old-school python and pip commands. So if you are working in a virtual environment To run a file: python myfile.py To install a module: pip install Note most good IDEs have the virtual environment management built in and often enabled by default. More on reddit.com
🌐 r/learnpython
99
209
January 28, 2022
People also ask

Does the Python installer for Windows add to PATH
ANS: Yes, since Python 3.3, the Windows installer typically offers an option to “Add Python to PATH” during installation. Make sure to select this if available.
🌐
sqlpey.com
sqlpey.com › python › fix-python-path-windows
Fix Python Path on Windows: Step-by-Step Solutions - sqlpey
How do I add Python's Scripts directory to PATH
ANS: The Scripts directory often contains important executables like pip. You can add it to your PATH similarly to the main Python directory, usually as ;C:\Python27\Scripts. Some solutions automate this.
🌐
sqlpey.com
sqlpey.com › python › fix-python-path-windows
Fix Python Path on Windows: Step-by-Step Solutions - sqlpey
Why does typing 'python' in cmd not work after installation
ANS: After installing Python, its location isn’t automatically known to the command prompt. You need to add the directory containing python.exe to the system’s PATH environment variable so Windows can find it.
🌐
sqlpey.com
sqlpey.com › python › fix-python-path-windows
Fix Python Path on Windows: Step-by-Step Solutions - sqlpey
🌐
Python
docs.python.org › 3 › using › windows.html
4. Using Python on Windows — Python 3.15.2 documentation
The directory will be %LocalAppData%\Python\bin by default, but may be customized by an administrator. Click Start and search for “Edit environment variables for your account” for the system settings page to add the path.
🌐
Real Python
realpython.com › add-python-to-path
How to Add Python to PATH – Real Python
July 23, 2026 - You may need to reboot your computer ... environment variable from the command line, check out the section on Configuring Environment Variables in the Windows Python coding setup guide....
🌐
Redreamality
redreamality.com › blog › pythonpathvs-code
How to Set PYTHONPATH on Windows, Linux, macOS and VS Code
August 21, 2025 - Important Note: You need to reopen any existing Command Prompt or PowerShell windows for the new environment variable settings to take effect. On Unix-like systems (such as macOS and Linux), setting environment variables is similar and typically involves modifying the shell configuration files. The path separator is a colon (:). This setting is only valid for the current terminal session. ... To make PYTHONPATH available every time you open a new terminal, you need to add it to your shell configuration file.
🌐
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 full installation path to your Python installation with Scripts added to the end of it. In our example, we are using: C:UsersAdministratorAppDataLocalProgramsPythonPython313Scripts · Check the path again using the method listed above to verify the installation. PATH order determines which executable file you access first after entering a command. How it works: When you run a command in Command Prompt/ PowerShell, Windows scans through the directories listed in PATH – from top to bottom attempting to find a matching executable, running the first one that matters.
Find elsewhere
🌐
sqlpey
sqlpey.com › python › fix-python-path-windows
Fix Python Path on Windows: Step-by-Step Solutions - sqlpey
November 4, 2025 - When you install Python on Windows, it’s not automatically set up so that you can type python in the command prompt and have it execute. This is because the operating system needs to know where the Python executable is located. This is achieved by adding the directory containing python.exe to the system’s PATH environment variable.
🌐
Net Informations
net-informations.com › python › intro › path.htm
How to set python path
For enhanced Python accessibility via a command prompt, it's advisable to modify certain default environment variables within Windows. To temporarily set environment variables , open Command Prompt and use the set command: C:\>set PATH=C:\Program Files\Python 3.6;%PATH%
🌐
Linux Hint
linuxhint.com › add-python-windows-path
How to Add Python to Windows Path? – Linux Hint
Step 1: Open Windows Command Prompt Run the Windows Command Prompt as administrator by searching “Command Prompt” from the “Startup” menu: Step 2: Add Python to Windows Path Set Python Path environment variable using provided command. The below-provided command will set Python to the ...
🌐
Python Pool
pythonpool.com › home › how to › set the default python path on windows: path, py, and virtual environments
Set the Default Python Path on Windows: PATH, py, and Virtual Environments
July 13, 2026 - On Windows, “setting the Python path” usually means adding the folder that contains python.exe to the PATH environment variable. Once that folder is on PATH, Command Prompt and PowerShell can find Python when you type python.
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-set-your-python-path-on-windows
How to set your python path on Windows?
March 24, 2026 - After setting the environment variable, open a new Command Prompt and verify the path ? ... Your custom directory should appear in the output. In most cases, you should avoid modifying PYTHONPATH. Instead, consider these alternatives: ... Install your package in development mode with pip install -e . While you can set PYTHONPATH through Windows Environment Variables, it's generally better to use proper package installation methods.
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows › dev-environment › python
Python on Windows for beginners | Microsoft Learn
September 14, 2026 - When running, you can inspect the sys.path variable to see which directories will be searched when you import something. To set this variable from the Command Prompt, use: set PYTHONPATH=list;of;paths.
🌐
Great Learning
mygreatlearning.com › blog › it/software development › how to add python to path?
How To Add Python To Path?
November 15, 2024 - After completing these steps, Python will be added to the system path, allowing you to run Python commands from any directory without specifying the full path. This means you can easily access Python commands without navigating to the Python installation directory each time. Learn the ins and outs of Python lists in "Python List : All You Need To Know About Python List". When you type a command in the Command Prompt on Windows, the system tries to find an executable file for that command within the directories listed in the Path variable.
Top answer
1 of 1
1

py.exe is the Python Launcher for Windows and is a separate program from any given python.exe. However, its intended purpose is to allow multiple versions of Python to be ran with minimal fuss. So, for instance, if you hypothetically needed to run Python 2.7 or Python 3.6, you could just use something like e.g. py -2.7 or py -3.6 (assuming both were versions which were installed and recognized on your system).

But for some of my programs I need to use python in order to be able to run my code.

If you really wish to use a single version of Python from the command line, simply add the folder where your prefered python.exe resides to your PATH/Path variable(s).

On Windows 7:

  • Go to Control Panel\System and Security\System.

  • Click the Advanced system settings link.

  • Select the Advanced tab from the System Properties dialog box and click the Environment Variables... button.

  • Edit your PATH (User) and/or Path (System) variables to include e.g. C:\path\to\your\preferred\python.exe (remember to put a ; at the end of the last listed path before putting the path to your python.exe).

  • Click OK when finished.

In Windows 10, you can:

  • Search for the Control Panel from the Start Menu.

    Or you can:

  • Search for env from the Start Menu and click the link to edit your environment variables.

  • You will still need to click the Environment Variables... button in either case under the Advanced tab from the System Properties dialog box.

  • Click Edit and add your C:\path\to\your\preferred\python.exe path to the appropriate PATH (User) and/or Path (System) variable list.

  • Click OK when finished.

python should now be available from the command line. If you are still having trouble running it, you may need to log out and then log back in (rebooting is typically unnecessary).


"Python" As A Batch File

While a bit of a hack, you can also "alias" py.exe as python with a batch file.

Create a new .txt file and and put e.g.:

C:\path\to\your\py.exe %*

Save it and rename it to python.bat.

Then place this batch file in your PATH\Path variable(s), as above (ex. as C:\path\to\your\python.bat).

In this case, you're still using py.exe in the background but using python (a.k.a. python.bat) to call it. The %* notation allows any variables (e.g. script names, options, etc.) to be passed along automatically to py.exe.

To be clear, you can simply use python from the command line with this method. You do not need to use python.bat.


As a final, final note, while not recommended, you could also probably simply change the name of py.exe to python.exe if you really wanted to.


🌐
Geek University
geek-university.com › home › python online course › add python to path on windows
Add Python to PATH on Windows · Geek University
If Python is installed on Windows but the python command does not work in Command Prompt, the interpreter directory may not be in the Windows PATH. This guide shows how to find python.exe, add its folder safely, and test the result. PATH is an environment variable: a named operating-system setting inherited by applications and command shells.
🌐
Geek University
geek-university.com › home › topic index › add python to the windows path
Add Python to the Windows PATH · Geek University
PATH configuration does not install Python. It only tells Windows where an existing installation can be found. New terminal windows inherit the updated value, so you can use Python without changing to its installation directory first. In Command Prompt, a missing or unusable PATH entry commonly produces a message similar to:
🌐
Data to Fish
datatofish.com › add-python-to-windows-path
How to Add Python to Windows PATH
You can easily add Python to Windows PATH by downloading a recent version of Python and then checking the Add python.exe to PATH box at the bottom of the setup screen: Finish the installation, and you are good to go! You can verify that you correctly added Python to PATH by typing the following ...
🌐
YouTube
youtube.com › watch
How to Add Python to PATH on Windows (Step-by-Step Guide) - YouTube
Learn how to manually add Python to the PATH on Windows. This lets you run Python and pip from the command prompt. Step-by-step instructions show how to loca...
Published: March 18, 2026