4

I cannot figure out what is going on here. I have just installed Anaconda, and I am trying to get my #! /usr/bin/env python shebang to return the new interpreter. I have no python aliases, and ~/miniconda3/bin is the first entry in my PATH.

Even so, when I run env python -V I get Python 2.7.8, while if I run python -V I get Python 3.5.1 :: Contiuum Analytics, Inc.. This is very curious, and I cannot find any helpful discussions online.

type -a python gives the reasonable result:

python is /Users/aa/miniconda3/bin/python
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /Library/Frameworks/Python.framework/Versions/3.0/bin/python
python is /usr/bin/python
python is /usr/local/bin/python

hash -r python does not seem to help.

Thanks!

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
abatea
  • 61
  • 2
  • What is output of "env which python" ? What is output of -V on /usr/bin/python & /usr/local/bin/python ? What are the timestamps on these files ? What is output of "which env" & "type -a env" ? Finally , what is output of "env -i which python" ? These outputs will have the clue to your problem. – Prem Feb 26 '16 at 08:36
  • Everything here points to the Apple frameworks... "which env" and "type -a env" both point to the normal "/usr/bin/env". "env -i which python" has no output. Do you have any other ideas? Thanks! – abatea Feb 26 '16 at 15:55

1 Answers1

2

Ah, ha! The problem is with the path that I'm exporting: ~/miniconda/bin evaluates properly in bash, but env does not handle it. Changing the path exported from .bash_profile to /Users/aa/miniconda3/bin/ solves the problem. Now both env python -V and python -V return the new version.

abatea
  • 61
  • 2