Open In App

How to set up Command Prompt for Python in Windows10 ?

Last Updated : 28 Jul, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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.

You can see Python3 is installed on my computer

If python is not installed on your computer, then it can be installed with How to install Python on Windows?

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”

Click on “Open file location”

After opening the file location copy the path.

Copy the location 

Step 5: Now go to the windows search bar and search for “Environment variables” and open it.

Open this  

After opening the menu click on “Environment Variables”

Click on the “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.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads