I am running python 2.7, I can run a program fine when I open the *.py
file.
But when I go to cmd and type "python *.py any other args
", it doesn't work, it says that python is not recognised. This is hard because I am trying to do things like sys.argv[]
, any help is great.
Thanks
To run Python scripts with the python command, you need to open a command-line and type in the word python , or python3 if you have both versions, followed by the path to your script, just like this: $ python3 hello.py Hello World! If everything works okay, after you press Enter , you'll see the phrase Hello World!
The default Python interpreter is referenced on Windows using the command py. Using the Command Prompt, you can use the -V option to print out the version. You can also specify the version of Python you'd like to run. For Windows, you can just provide an option like -2.7 to run version 2.7.
You can solve this creating a bat file contenting:
cd %USERPROFILE%\AppData\Local\Programs\Python\Python37-32
cls
.\python
Then, you save on C:\Windows\System32 as python.bat
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With