Set Python Environment Variable in Window 10
Post date: Dec 31, 2017 5:39:33 AM
Python Environment Variables
Here are important environment variables, which can be recognized by Python −
The simple way
To use Python within a command window, do this: Open a new command window and type the set path command:
set path=C:\Python
(Use the path you just discovered!) This tells the command window to find the Python interpreter, python.exe, in the folder, C:\Python24.
Now, type
python
You should see the start-up message for the Python interpreter. Success! Now, exit the interpreter. (Type exit) (If you do not see the start-up message, double-check the path to python.exe!)
Now you are ready to use the same command window to cd to the folder where your Python programs reside, and you can use the Python interpreter to execute them.
The permanent way to set the path
Each time you open a command window, you must type the set path command to set the path to Python. It is a bit annoying to do this every time you open a command window, and there is a clever repair --- you can reset permanently the value of Windows's PATH variable so that Windows 10 knows once and for all the path to Python. Here is what you must do on Windows 10 to reset the PATH variable:
Go to Start Menu
select Control Panel
On the Control Panel window go to view large icon so that you will be able to see all window.
Double click on the icon for System
In the System window, click on Advance System Setting
Click on the button Environment Variables
In the new window, scroll until you see the variable, Path; click on it
Press Edit
Carefully use the right arrow button to move to the end of the long sequence of folder names. At the very end, without including any extra blanks, type this:
;C:\Python
Close all the windows and restart the computer. Now, when you open a command window, you can type python and the path is already known by Windows