суббота, 13 апреля 2019 г.

Add Python to the PATH Environmental Variable (‘python’ is not recognized as an internal or external command)

Many developers install Python on their Windows machine, and when they try to run the console command python.exe, they get the following error message:
‘python’ is not recognized as an internal or external command
.
We'll show you how to install Python, and fix this error. By adding Python to the PATH environmental variable.

Step 1: Download Python

First visit the official Python download page and download the latest release. At the time of this writing the latest versions are 2.7.3 and 3.3.0.
Python Download List
Install it by double clicking the Python installer setup file and follow the wizard along.

Step 2: Add Python to the PATH Environmental Variable

Next, let's click on the Start Menu and right click My Computer. Click on Advanced System Settings.
My Computer Screenshot
Advanced System Settings
Then click on Environment Variables. This is where we can add Python to the PATH environmental variable.
Add Python to The PATH Environment Variable
Find the PATH variable and click Edit. You want to add Python to this PATH variable by adding ;C:\Python27 to the end of that string (or whatever the path to your Python installation is).
Save your changes!
Changing Environment Variables
Edit Environment Variables
So what exactly is happening here?
When you type in python in a command prompt, Windows will use the PATH environmental variable to get a list of directories to go looking for the python.exe file. Before you followed the steps here, it couldn’t find the python.exe file, hence the error.
Now that the PATH variable is set, when you execute python via the Windows console, you'll see a familiar programming prompt.
Python Windows Screenshot
Python running on Windows!

0 коммент.:

Отправить комментарий