Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Standardized python binary location?

Tags:

python

On a native Mac OS X install, I see Python binary at /usr/bin at version 2.6

Recently I installed Python 2.7.2 from the official binaries and it installed it at /usr/local/bin

What path of the Python interpreter should I give in my #! which will be standardized across all platforms?

I am assuming it could be /usr/bin so that I may have to symlink /usr/bin/python to /usr/local/bin/python but I just wanted to sure before I do this

like image 659
Vaibhav Bajpai Avatar asked Jul 20 '26 22:07

Vaibhav Bajpai


1 Answers

Nope. You would use env to find the python executable in $PATH and run it as appropriate.

#!/usr/bin/env python

print 'Hi mom!'
like image 50
Ignacio Vazquez-Abrams Avatar answered Jul 23 '26 13:07

Ignacio Vazquez-Abrams