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
🌐
Simplilearn
simplilearn.com › home › resources › software development › understanding the python path environment variable in python
Understanding the Python Path Environment Variable in Python [Updated]
September 14, 2025 - Python path is an environment variable used to maintain directories of custom Python libraries. Learn how to set a python path variable on Windows and Mac now!
Address: 5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
GeeksforGeeks
geeksforgeeks.org › python › pythonpath-environment-variable-in-python
PYTHONPATH Environment Variable in Python - GeeksforGeeks
January 9, 2026 - Step 4: Now in the new Environment Variable dialog box click on New as shown below. Step 5: Now in the variable dialog box add the name of the variable as PYTHONPATH and in value add the location to the module directory that you want python to check every time as shown below. Step 6: Now open your command prompt and execute the my_script.py file with the below command: ... Now Python can locate your module and the script should run without errors.
Discussions

python - How to add to the PYTHONPATH in Windows, so it finds my modules/packages? - Stack Overflow
I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly. I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment ... More on stackoverflow.com
🌐 stackoverflow.com
windows - how to set PATH=%PATH% as environment in Python script? - Stack Overflow
I'am trying to start an exe file ... visual studio) from a python program. In the properties of this c++ project (configuration ->properties-> debugging-> environment) the following setting in the ... Path is an operating system environment variable, changing it can damage ... 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
how do I modify the system path variable in python script? - Stack Overflow
I'm trying to run a python script from cron, but its not running properly so I'm assuming its the different path env variable. Is there anyway to change the variable within a python script? More on stackoverflow.com
🌐 stackoverflow.com
People also ask

How do I add an environment variable in Pythonpath?
Following a few steps will allow you to add an environment variable: By setting the Pythonpath environment variable. By adding manually to the path in the file.  By using the os.environ module method.  Then you can also use the os.environ["key"] = "value" syntax to add a single environment variable.
🌐
simplilearn.com
simplilearn.com › home › resources › software development › understanding the python path environment variable in python
Understanding the Python Path Environment Variable in Python [Updated]
How do I create a Pythonpath variable?
To create a Pythonpath variable, you will need to first open the Command Prompt.  Once the Command Prompt is open, you will need to type in the following command: setx /M Pythonpath "C:\Python27\Lib".  And you should know that creating a Pythonpath environment variable in Python will be changing depending on your operating system and whether you want the variable to be permanent. On Windows, you can use the set command to create a Pythonpath variable:set Pythonpath=C:\python On Mac or Linux, you can use the export command to create a Pythonpath variable:export Pythonpath =/usr/local/lib/python
🌐
simplilearn.com
simplilearn.com › home › resources › software development › understanding the python path environment variable in python
Understanding the Python Path Environment Variable in Python [Updated]
Is SYS path the same as Pythonpath?
The SYS path is a list of directories that Python interprets to search for when it starts up.  The Pythonpath is a list of directories that the Python interpreter will search for when it tries to resolve a module name.  So, both look the same but are quite different.
🌐
simplilearn.com
simplilearn.com › home › resources › software development › understanding the python path environment variable in python
Understanding the Python Path Environment Variable in Python [Updated]
🌐
GitHub
bic-berkeley.github.io › psych-214-fall-2016 › using_pythonpath.html
Using PYTHONPATH — Functional MRI methods
From the advanced system settings dialog, choose the “Environment variables” button: In the Environment variables dialog, click the “New” button in the top half of the dialog, to make a new user variable: Give the variable name as PYTHONPATH and the value is the path to the code directory.
🌐
Great Learning
mygreatlearning.com › blog › it/software development › how to add python to path?
How To Add Python To Path?
November 15, 2024 - Windows: Select the "Path" variable and click "Edit." Then click "New" and add the path to your Python installation directory. Click "OK" to save. macOS and Linux: - Use a text editor like Nano to open the system environment file.
🌐
Real Python
realpython.com › add-python-to-path
How to Add Python to PATH – Real Python
July 23, 2026 - The command export PATH="<PATH_TO_PYTHON>:$PATH" prepends <PATH_TO_PYTHON> to the PATH environment variable. It’s similar to the following operation in Python: ... >>> PATH = "/home/realpython/apps:/bin" >>> PATH = f"/home/realpython/pyth...
🌐
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.
Find elsewhere
🌐
Redreamality
redreamality.com › blog › pythonpathvs-code
How to Set PYTHONPATH on Windows, Linux, macOS and VS Code
August 21, 2025 - # macOS/Linux Example PYTHONPATH=./src:/path/to/another/lib # Windows Example PYTHONPATH=./src;C:\path\to\another\lib · Configure VS Code to load the .env file. Set python.envFile to identify the environment file. To inject these variables into new integrated terminals, also enable python.terminal.useEnvFile, which defaults to false.
🌐
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.
🌐
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
🌐
Net Informations
net-informations.com › python › intro › path.htm
How to set python path
My Computer > Properties > Advanced System Settings > Environment Variables > Click the "New" button in the top half of the dialog, to make a new user variable. Give the variable name as PYTHONPATH and the value is the path to the code directory.
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-set-python-environment-variable-pythonpath-on-linux
How to set Python environment variable PYTHONPATH on Linux?
March 24, 2026 - The PYTHONPATH environment variable tells Python where to look for modules and packages beyond the standard library. Setting it correctly on Linux ensures your custom modules can be imported from any location.
🌐
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:
🌐
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.

🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to add python to path on windows, linux, and mac
How to Add Python to PATH on Windows, Linux, and Mac
December 12, 2025 - Because the two systems share fundamental design similarities, the procedure for adding the Python directory to PATH on Linux and macOS is the same. Edit the PATH variable by executing the steps below. The export command lets you change environmental variables such as PATH.
🌐
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
🌐
Machine Learning Plus
machinelearningplus.com › blog › add python to path – how to add python to the path environment variable in windows?
add Python to PATH - How to add Python to the PATH environment variable in Windows? | MLPlus
March 23, 2023 - Step 6. In the Environment Variables dialog, find the “Path” variable under the “System variables” section, and click on the “Edit” button. Step 7. In the “Edit environment variable” dialog, click on the “New” button, and ...
🌐
YouTube
youtube.com › corey schafer
Python Tutorial: How to Set the Path and Switch Between Different Versions/Executables (Windows) - YouTube
In this Python Programming Tutorial, we will be learning how to set the PATH environment variable on the Windows Operating Systems.Be one of the first 200 pe...
Published: July 26, 2018
Views: 202K