Run Python Script in Windows 10 Command Prompt for Beginners – Python Tutorial

By | December 14, 2019

As a python beginner, one of things you should know is how to run python script.  In this tutorial, we will introduce you the way to run python script in windows 10 command prompt.

Install python

To run python script in windows 10 system, you should install python first. We recommend you to install python using anaconda, which can help you to void some settings when using python and can manage python libraries easily.

Install and Use Both Python 2 and Python 3 in Windows with Anaconda – Python Tutorial

Run python script in command prompt

After having installed python, we can run python script by windows command prompt.

We can open command prompt and run python script like:

python python_file.py

Where python_file.py is the absolute path of a python file. For example:

python d:\example\test.py

In this example, we will run python script test.py, which is in the directory d:\example.

We also can locate to the d:\example and run test.py.

cd d:\example
d:
python test.py

You will find that running python script in windows command prompt is very easy.

Leave a Reply

Your email address will not be published. Required fields are marked *