what’s the difference between “python scriptname.py” and just “scriptname.py”?
I meet the problem when using commands in Django, and this really confuse me
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You mean when executing those statements on the command line? The difference is “python scriptname.py” explicitly invokes the program named “python” in your path (in Linux, typing “which python” will tell you where the program lives), wheras “scriptname.py” is just executing that file, feeding it to the shell for interpreting. If you give it to the shell, it should have something at the top defining what program to invoke when executed (in Linux, something like /usr/bin/python). The shell then executes that program with the rest of your script, effectively doing the same thing as the first statement.