1

I routinely have this problem on my Mac when I'm using pip to install a Python package. It'll translate the /usr/bin/env shebang into the actual executable that was derived. Usually, it seems to happen when I express a version: /usr/bin/env python2.7

However, today, it started doing this to my /usr/bin/env python shebangs.

Starts with:

#!/usr/bin/env python

Translated to, during install:

#!python

..which doesn't work at all:

-bash: /usr/local/bin/xyz: python: bad interpreter: No such file or directory

Does anyone have any suggestions? According to Google, I'm the only one having this problem on the planet.

Christian Berendt
  • 3,416
  • 2
  • 13
  • 22
Dustin Oprea
  • 9,673
  • 13
  • 65
  • 105
  • 1
    where is the python binary on your system? `#!python` forces the system to scan the path for the binary, and it's obviously not anywhere that `$PATH` points at. – Marc B Jun 24 '14 at 18:58
  • check `which python` in your terminal – Haifeng Zhang Jun 24 '14 at 19:01
  • Why is `pip` modifying the files in the first place? Never heard of this... – Bakuriu Jun 24 '14 at 19:06
  • 2
    @MarcB - bash shebang doesn't search $PATH - that's why `#!/usr/bin/env python` is used - env does search $PATH. – tdelaney Jun 24 '14 at 19:21
  • Good news! You are not the only one on the planet with this problem. http://stackoverflow.com/questions/1530702/dont-touch-my-shebang You can try installing manually with the format the question suggests. Or try installing in a virtualenv and see if that works. As other commenters have pointed out there is likely an environment problem here. – Bachmann Jun 24 '14 at 19:28
  • As @Bachmann says, its a setup.py thing. Any chance python was in your current directory when you ran pip (e.g., you were in /usr/bin?). – tdelaney Jun 24 '14 at 19:37
  • @Bachmann Thanks for that link. I'm definitely clear on why it happens now, but it's infuriating as the result I'm referring to seems to happen unpredictably (and it's fair to assume that I follow the same patterns, with every project). – Dustin Oprea Jun 25 '14 at 03:02
  • @tdelaney No, it's not. I wasn't even in a virtualenv at the time. I can't explain why it happened then, and I definitely can't explain why it's *not* happening now. It's the same project, nothing has changed with the scripts, and all seventeen now reflect a viable Python executable. Ridiculous. – Dustin Oprea Jun 25 '14 at 03:03

0 Answers0