"#!/usr/bin/env python" vs. "#!/usr/bin/python"?

Jussi Piitulainen jpiitula at ling.helsinki.fi
Fri Sep 28 06:49:07 EDT 2012


Gilles writes:

> #!/usr/bin/env python
> #!/usr/bin/python
> 
> What's the difference?

Not much if your python is /usr/bin/python: env looks for python and
finds the same executable.

When python is not /usr/bin/python but something else that is still
found by your system, /usr/bin/env still finds it.

For example, in a server where I work, python3 is installed as
something like /opt/python/3.2.2-gcc/bin/python3. There is no
/usr/bin/python3 at all, but "#! /usr/bin/env python3" works.



More information about the Python-list mailing list