Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is '#!/usr/bin/env python' supposedly more correct than just '#!/usr/bin/python'?

Tags:

python

bash

Anyone know this? I've never been able to find an answer.

like image 242
Kenneth Reitz Avatar asked Aug 30 '09 02:08

Kenneth Reitz


People also ask

Why is the sky blue short answer?

Blue light is scattered in all directions by the tiny molecules of air in Earth's atmosphere. Blue is scattered more than other colors because it travels as shorter, smaller waves. This is why we see a blue sky most of the time.

Why does the sky look blue?

The sky during the day During the day the sky looks blue because it's the blue light that gets scattered the most. It's redirected into many different directions all over the sky, whereas the other wavelengths aren't scattered as much.

Is the sky blue because of the ocean?

You asked about the sky. We know the sky is blue and the sea does reflect some of this light. So, yes, it does play a role. To sum it all up: the sea is blue because of the way water absorbs light, the way particles in the water scatter light, and also because some of the blue light from the sky is reflected.

Why is the sky blue GCSE?

Greg then demonstrates that the graphs for sky colour and atmospheric pressure are a very close match. He finishes by explaining that the sunlight is scattered by the Earth's atmosphere and that this effect increases as the atmosphere gets denser near the Earth's surface. This makes the sky look blue.


1 Answers

If you're prone to installing python in various and interesting places on your PATH (as in $PATH in typical Unix shells, %PATH on typical Windows ones), using /usr/bin/env will accomodate your whim (well, in Unix-like environments at least) while going directly to /usr/bin/python won't. But losing control of what version of Python your scripts run under is no unalloyed bargain... if you look at my code you're more likely to see it start with, e.g., #!/usr/local/bin/python2.5 rather than with an open and accepting #!/usr/bin/env python -- assuming the script is important I like to ensure it's run with the specific version I have tested and developed it with, NOT a semi-random one;-).

like image 93
Alex Martelli Avatar answered Oct 10 '22 01:10

Alex Martelli