I have looked at this explanation on how to put Python as a system variable for Path
. This worked successfully and from my cmd
I can now run python which will result in the terminal changing to the >>>
notation.
However, I am not able to run the script test.py
even when I cd
into the right directory. I get the error: name test not defined
.
My first question is: how can I solve this and should I solve it?
Digging a bit deeper, I also found that there is the IDLE Python shell that comes with the installation of Python. This interface comes provides support for the >>>
notation and you can run Python code in it. My guess that it is better to use this interface to run scripts. However, it is not clear to me how to cd into the right directory and run the file test.py
(located in: C:\dev
). How should I do run it? Is there a way to cd
into a directory/workspace?
So basically, how do I run a python file and where should I run it? cmd or in the shell?