#! to two different pythons?

Cameron Simpson cs at zip.com.au
Sat Jun 6 20:09:51 EDT 2009


On 06Jun2009 23:46, mh at pixar.com <mh at pixar.com> wrote:
| Benjamin Peterson <benjamin at python.org> wrote:
| > #!/usr/bin/env python
| 
| But how can I handle this with two differently named pythons?
| 
|     #!/usr/anim/menv/bin/pypix
|     #!/Users/mh/py/bin/python

Well, it depends _why_ you have a python named "pypix", but two
solutions suggest themselves:

  - Keep the "#!/usr/bin/env python" and then:
      ln -s /usr/anim/menv/bin/pypix /usr/local/bin/python
    Presumes no other python, and /usr/local/bin might become ~/bin
    or something like that.

  - Write a small wrapper shell script and use:
      #!/usr/bin/env my-wrapper-script

Regarding the first approach, on a personal basis I have two bin
directories: ~/bin and ~/bin-local on the machines I use. The former it
copied from my home account and is always the same - a bunch of useful
scripts. The latter is per-host customisation and is largely symlinks
to preferred versions of apps, apps installed out of the main paths,
and host-specific wrapper scripts.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Soon, Grasshopper, all will understand. And dispair.  The government that
defines what is good for you, will also dictate what is bad.
        - Curt Howland  "Ace"   DoD#0663  EGFC#011  EFF#569
          howland at Priss.com                   '82 V45 Sabre



More information about the Python-list mailing list