What does "#!/usr/bin/env python" do?
Hallvard B Furuseth (nospam nospam)
h.b.furuseth at usit.uio.no
Mon Nov 10 02:20:55 EST 2003
More information about the Python-list mailing list
Mon Nov 10 02:20:55 EST 2003
- Previous message (by thread): What does "#!/usr/bin/env python" do?
- Next message (by thread): What does "#!/usr/bin/env python" do?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Parzival wrote: > I am a now immigrant to Linux from (the old country) > Can someone explain what the line: > > #!/usr/bin/env python > > at the start of a python script does? All my reading of > bash and env manpages would lead me to believe that > > #!python > > is equivalent to the first line, but not speaking well the > language am I, so here the question am I asking. At least on the operating systems I have checked, #! must be followed by the full pathname of a program. It does not search $PATH for it. '/usr/bin/env python' searches $PATH for python and runs it. (Usually env is used to set some environment variables for a program, e.g. 'env PYTHONPATH=whatever python', but one need not specify any environment variables.) Since env is (almost?) always in /usr/bin, while python can be installed God-knows-where, that is more portable than writing #!/local/bin/python or #!/usr/bin/python or whatever. -- Hallvard
- Previous message (by thread): What does "#!/usr/bin/env python" do?
- Next message (by thread): What does "#!/usr/bin/env python" do?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list