We all know that nowadays Python is one of the most popular coding languages among all. While installing Python, one IDE named IDLE is also installed. Using the IDLE we can write and also run our programs. But we can also run python programs on CMD or command prompt as CMD is the default command-line interpreter on Windows.
But there’s a need to set up the environment variable in windows to use python on the command-line. Following are the steps to add Python Environment to Windows path:
Step 1: For setting up Python on CMD we must check whether Python is installed on your machine or not. For doing this go to the Windows search bar and search for python. If you find python in the result then you are good to go.
Step 2: Now check whether python is already set up in Command Prompt or not. For doing this just open cmd and type python. If you see any python version then it is already setup.
You can see after typing python nothing happened. So, python is not set up on cmd yet.
Step 3: Now open the Windows search bar and search for “idle”. Without opening the app click on “Open file location”. If you didn’t get the option right click on the app and you will get it.
Now a file location will be opened on Windows explorer.
Step 4: Now right-click on “IDLE” and click on “open file location”
After opening the file location copy the path.
Step 5: Now go to the windows search bar and search for “Environment variables” and open it.
After opening the menu click on “Environment Variables”
Now double click on the “path” in the “System Variables”
In the “Edit System Variable” menu click on “new”, then paste the file location you copied and click ok.
Now close the Environment menus by clicking ok and congratulation, we have set up the Command Prompt for python.
Step 6: Now check whether it works. Open Command Prompt and type “python” and hit enter. You will see a python version and now you can run your program there.