nksmith06 at cs.earlham.edu
Tue Oct 9 17:28:05 CEST 2007
> I want to make a binary file , which would execute on it's own.
$ which python
to get the location of your python binary. The default, i think, is just
Then add this line to the top of your file:
#!/usr/bin/python (or whatever the `which` command returned)
then finally do this command:
$ chmod +x <file>.py
This makes <file> executable ( that's what the x stands for ).
now run it with:
you can also trim the .py from the file and it will work just the same.
To have your script work like installed binaries, put it in a folder in your
PATH variable. For example, if you added the path /home/<you>/bin/ to your
path variable ( PATH=$PATH:/home/<you>/bin/ ) Bash would search that
directory when you typed in a command to execute. What this means is if you
rename your <file>.py to just <file> and stick it in /home/<you>/bin/ you
could just do
at any time to run your program.
hope my verbosity is helpful.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list