I am learning Python and DJango and I am relatively nub with Linux. When I create DJango project I have manage.py
file which I can execute like ./manage.py runserver
. However when I create some Python program by hand it looks like that my Linux trying to execute it using Bash, not Python. So i need to write python foo.py
instead ./foo.py
. Attributes of both files manage.py
and foo.py
are the same (-rwx--x---
). So my Q is: where is difference and how I can execute python program without specifying python
? Links to any documentations are very appreciate. Thanks.
Asked
Active
Viewed 180 times
1
3 Answers
1
I am just gonna add this for more clarity and to anyone coming across this post who might need an explanation.
Why do people write #!/usr/bin/env python on the first line of a Python script?
explains why you should it is used.
-
I needed an explanation and I already found it when @levi explain to me the direction of search. In any case thanks and +1 – Abelisto Nov 02 '15 at 08:57
-2
Save your python code file somewhere, using "Save" or "Save as" in your editor. Lets call it 'first.py' in some folder, like "pyscripts" that you make on your Desktop. Open a prompt (a Windows 'cmd' shell that is a text interface into the computer): start > run > "cmd".

Abhi
- 1
-
-
I am not such nub to saving anything to the folder on the Windows desktop *~<;o) Yes you are really missed `linux` in the question tags (I does not downvote your answer if any, thanks for try and have fun) – Abelisto Nov 02 '15 at 07:27