Some time ago I asked about executing a python program or script. For
windows, I was informed that the .py extension could be added to some list
of executable extensions, and then I could just type "mycode" instead of
"python mycode.py". Great advice, worked like a charm.
I recently jumped ship, and have been running Gentoo Linux for about two
months. Is it possible to get the same behavior on Linux? I thought it
would have something to do with adding the #!/usr/bin/env python line to my
code, but I''m not sure what this is supposed to do (it didnt work, that
much I know.)
Could I get some advice?
Thanks,
Darren
解决方案Darren Dale
writes:Some time ago I asked about executing a python program or script. For
windows, I was informed that the .py extension could be added to some list
of executable extensions, and then I could just type "mycode" instead of
"python mycode.py". Great advice, worked like a charm.
I recently jumped ship, and have been running Gentoo Linux for about two
months. Is it possible to get the same behavior on Linux? I thought it
would have something to do with adding the #!/usr/bin/env python line to my
code, but I''m not sure what this is supposed to do (it didnt work, that
much I know.)
How didn''t it work? What did you do and what happened? What errors
were printed? Did you use chmod to make the script executable? Is
the script in a directory that''s in your PATH? Is Python installed
on the system?
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Michael Fuhr wrote:
Darren Dale
writes:Some time ago I asked about executing a python program or script. For
windows, I was informed that the .py extension could be added to some
list of executable extensions, and then I could just type "mycode"
instead of "python mycode.py". Great advice, worked like a charm.
I recently jumped ship, and have been running Gentoo Linux for about two
months. Is it possible to get the same behavior on Linux? I thought it
would have something to do with adding the #!/usr/bin/env python line to
my code, but I''m not sure what this is supposed to do (it didnt work,
that much I know.)
How didn''t it work? What did you do and what happened? What errors
were printed? Did you use chmod to make the script executable? Is
the script in a directory that''s in your PATH? Is Python installed
on the system?
Yes, I did chmod, the script is in the current directory.
mycode.py
bash: mycode.py: command not found
I just tried: