How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (2024)

Last Updated : 28 Jul, 2020

Improve

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.

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (1)

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.

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (2)

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.

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (3)

Now a file location will be opened on Windows explorer.

Step 4: Now right-click on “IDLE” and click on “open file location”

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (4)

Click on “Open file location”

After opening the file location copy the path.

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (5)

Copy the location

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”

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (7)

Click on the “Environment Variables”

Now double click on the “path” in the “System Variables”

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (8)

In the “Edit System Variable” menu click on “new”, then paste the file location you copied and click ok.

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (9)

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.

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (10)


Like Article

Suggest improvement

Share your thoughts in the comments

Please Login to comment...

How to set up Command Prompt for Python in Windows10 ? - GeeksforGeeks (2024)
Top Articles
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 5639

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.