More about simple question
Erik Max Francis
max at alcyone.com
Tue Nov 5 16:28:04 EST 2002
xinghua shi wrote:
> I still have another question. If I have a file named:
> foo.py. then how can I get an excetable, say foo?
> In C, I could use
> % gcc foo.c -o foo
>
> So how can I do similar in Python?
> %python foo.py -o foo
> doesn't work of course.
Give it a bangpath that points to Python as the first line:
#!/usr/bin/env python
or maybe
#!/usr/local/bin/python
and make it executable. Then you can run it as ./foo.py. If you prefer
to run it without the the .py extension, then just rename the file to
foo. In UNIX and UNIX-like operating systems, executable scripts are
discerned by their bangpath, not by their file extension.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ It is one thing to praise discipline, and another to submit to it.
\__/ Cervantes
Rules for Buh / http://www.alcyone.com/max/projects/cards/buh.html
The official rules to the betting card game, Buh.
More information about the Python-list
mailing list