Your path to becoming an Ethical Hacker! Hacking Academy Try It Now!

Set up Command Prompt for Python in Windows10

Learn how to set up Python in Command Prompt on Windows easily. Follow these step-by-step instructions to install and configure Python for coding.
Setting up Command Prompt for Python in Windows 10 is crucial for coding in Python. This guide will walk you through the steps to configure Command Prompt, making it easier to run Python scripts and programs on your Windows 10 system. Let's dive in!

Python has become incredibly popular in the world of coding today. When you install Python, you also get an integrated development environment (IDE) called IDLE. This allows you to write and run your Python programs seamlessly. However, you can also run Python programs using the Command Prompt (CMD), which is the default command-line interpreter on Windows.

Set up Command Prompt for Python in Windows10

To use Python in the command-line, you need to set up the environment variable in Windows. Here's how you can add Python Environment to the Windows path:

Step 1: To set up Python on CMD, first, check if Python is installed on your machine. You can do this by searching for Python in the Windows search bar. If Python appears in the search results, you're all set.

Set up Command Prompt for Python in Windows10

If python is not installed on your computer, you can refer to How to install Python on Windows?

Step 2: Check if Python is already set up
To check if Python is already set up in Command Prompt, open the command prompt and type python. If you see a Python version displayed, it means Python is already set up on your system.

Set up Command Prompt for Python in Windows10

From the screenshot above, it appears that Python is not set up in your Command Prompt. When you type python and nothing happens, it indicates that the python command prompt is not recognized.

Step 3: Open Python IDLE
1. Open the Windows search bar and search for "idle".
2. Right-click on the Python IDLE app.
3. Click on "Open file location" to locate the IDLE executable.
4. If you don't see the option, right-click on the app to find it.

Set up Command Prompt for Python in Windows10

After following the previous steps and clicking on "Open file location," a Windows Explorer window will open, showing the location of the Python IDLE executable file.

Step 4: Locate Python IDLE
1. Right-click on the "IDLE" shortcut.
2. Click on "Open file location" to find the IDLE executable.

Set up Command Prompt for Python in Windows10

After opening the file location of Python IDLE, you can copy the path from the address bar of the Windows Explorer window. This path will be used in the next steps to set up Python in the Command Prompt.

Set up Command Prompt for Python in Windows10

Step 5: In the Windows search bar, type "Environment variables" and select "Edit the system environment variables."

Set up Command Prompt for Python in Windows10

In the System Properties window, click on the "Environment Variables" button.

Set up Command Prompt for Python in Windows10

Now, in the Environment Variables window, locate and double-click on the "Path" variable under the "System Variables" section. This will allow you to edit the Path variable.

Set up Command Prompt for Python in Windows10

In the "Edit Environment Variable" window, click on "New," paste the file location you copied earlier, and then click "OK." This will add the Python IDLE path to the system's Path variable, allowing you to run Python commands from the Command Prompt.

Set up Command Prompt for Python in Windows10

Now, close the Environment Variables windows by clicking "OK." Congratulations, you have successfully set up the Command Prompt to run Python commands.

Step 6: Test Python Installation
1. Open Command Prompt.
2. Type `python` and press Enter.
3. You should see the Python version displayed.
4. Now you can run your Python programs in the Command Prompt.

Set up Command Prompt for Python in Windows10

Don't Miss: Python Basics

Conclusion

Setting up Python in Command Prompt on Windows is a straightforward process that allows you to run Python programs and scripts directly from the command line. By following these steps, you can ensure that Python is properly installed and configured on your system, enabling you to start coding in Python right away.

Post a Comment

Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.