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
🌐
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.
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
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
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
🌐
Redreamality
redreamality.com › blog › pythonpathvs-code
How to Set PYTHONPATH on Windows, Linux, macOS and VS Code
August 21, 2025 - Python’s command-line reference defines the environment-ignoring flags. The following examples replace PYTHONPATH for the current shell session: Separate multiple directories with ; on Windows and : on Linux/macOS. Check the interpreter and its effective search path in the same terminal where the import fails:
🌐
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
The following steps will add python ... “Command Prompt” from the “Startup” menu: Step 2: Add Python to Windows Path Set Python Path environment variable using provided command....
Find elsewhere
🌐
Real Python
realpython.com › add-python-to-path
How to Add Python to PATH – Real Python
July 23, 2026 - Note: Pedantically speaking, rc files are generally for settings that affect the look and feel of your command-line prompt, not for configuring environment variables like PATH. But you can use rc files for your PATH configuration if you prefer. To add the Python path to the beginning of your PATH environment variable, you’re going to be executing a single command on the command line.
🌐
sqlpey
sqlpey.com › python › fix-python-path-windows
Fix Python Path on Windows: Step-by-Step Solutions - sqlpey
November 4, 2025 - Close all open command prompts and open a new one to test. REM Example: Assuming Python is in C:\Python27 REM After editing, you might have a Path entry like: REM ...;C:\Python27;C:\Python27\Scripts;... The setx command allows you to set environment variables from the command line.
🌐
Geek University
geek-university.com › home › python online course › add python to path on windows
Add Python to PATH on Windows · Geek University
Do not replace existing PATH entries. Optionally add the related Scripts directory for pip-installed commands. Open a new Command Prompt. Run python --version and where python. For related command-line basics, see Python command line, installing Python on Windows, and running Python code.
🌐
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.
🌐
Opt Node
optnode.com › home › guides › how to set python path in windows 10: a step-by-step guide
How to Set Python Path in Windows 10: A Step-by-Step Guide - Opt Node
March 5, 2026 - Open Command Prompt and type python --version. If it displays the Python version, you’ve set the path correctly. Once you complete these steps, Windows will know where to find Python, allowing you to run Python scripts from any command line interface without any hassle.
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.


🌐
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.
🌐
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
🌐
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.
🌐
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 ...
🌐
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:
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-set-your-python-path-on-windows
How to set your python path on Windows?
March 24, 2026 - The PYTHONPATH environment variable tells Python where to look for modules and packages beyond the standard library. While modifying PYTHONPATH is rarely needed, here's how to set it on Windows when necessary.
🌐
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.