Set Up The Python Path variable In Microsoft Windows 8
<< Previous lesson: Default Python Path Installation
- Let’s locate the directory where the Python executable is installed in our system, and note down the path to this directory.
- Open the "Start menu" and click "All apps" down arrow button in the bottom-left corner.
- Scroll through the list of apps and click a "Control Panel" on the "Windows System". The Control Panel will appear on the screen.
- Under "View by:", click "Category",
- then select the “System and Security” section.
- then select the “System” section on the right side.
- In the System window, click on Advanced System Settings on the left sidebar.
- In the System Properties window (Advanced tab):
- Click the Environment Variables button.
- Under the System Variables section, find Path variable.
- Click Edit button to modify the existing variable, or New button to create a new one, if the Path variable is not exist..
- In the Variable Name field, enter Path.
In the Variable Value field, add the path to our Python installation directory (e.g., "C:\Program Files\Python\pythonXX") to the list of paths if it’s not already there. - Click OK to apply the changes.
- Click OK again, click OK again in System Properties window, and restart the computer to ensure the changes take effect.
Set The Python Path Variable Via The Command Line
Notes
WARNING use the step "Set Up The Python Path variable In Microsoft Windows 8" from above, if you have Microsoft Windows Environment Variables Path more than 1024 characters!
If you would prefer to set the Python Path Variable via the command line:
- Open Command Prompt (make sure you "Run as administrator" with right click mouse, so you're able to add a system environment variable).
- Set the value of the environment variable to your Python installation path as follows:
setx /m PATH "C:\Program Files\Python\pythonXX" - Close and start Command Prompt window again to reload the environment variables then use the following command to check the it's been added correctly and restart the computer to ensure the changes take effect.
- Then use the following command to check the path to your Python installation been added correctly. Then you should see the path to your Python installation.
echo %PATH%
Notes:
- Be aware if you have Microsoft Windows Environment Variables Path over than 1024 characters when assigning contents to a variable using setx, it can result in loss of data previously held by the target variable like in this screencapture picture article post.
- If the Path variable or Expandable Environment-Variable Strings %PATH% is exist and not empty then you can add semicolon ( ; ) and then put the directory from the Python executable is installed in our system.
- Be aware If You running the command with an existing variable without double quotes (" "), Expandable Environment-Variable Strings %PATH% and semicolon ( ; ) can be removes any variable references.
- Only administrators account can change the Environment Variable.
- Non standard Command Prompt or PowerShell may not running well.
- XX is the python version.
- You can place the installed Python inside the no matter folder that able to execute your Python script and compile your Python script, for example "C:\Program Files\Python\pythonXX".
Next Lesson: How To Check Your Python Version >>
Bibliography
https://www.python.org/ ( manual ebook )
https://realpython.com/
https://superuser.com/
https://support.microsoft.com/en-us ( manual ebook )
https://learn.microsoft.com/ ( manual ebook )
https://winaero.com/
https://www.bleepingcomputer.com/
https://www.ionos.co.uk/
https://www.itechtics.com/
https://www.liquidweb.com/
install, setup, installation, python setup and usage, using python on windows, environment variable
Tidak ada komentar:
Posting Komentar