Installed Python 3.1 but Terminal only picks up 2.5

Discussion in 'Mac Programming' started by cossie, Jan 9, 2010.

  1. cossie macrumors member

    Joined:
    Aug 8, 2006
    #1
    Hi,

    I installed the most recent version of Python on my MBP, I tried using the script that comes with the Python package "Update profile shell.command" and I've tried setting my PATH as:

    Code:
    PATH="/Library/Frameworks/Python.framework/Versions/3.1/bin/python3:${PATH}"
    and

    Code:
    PATH="/Library/Frameworks/Python.framework/Versions/3.1/bin/
    But each time I go open up a Terminal window and type 'python' I get:
    "Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)"

    Can anyone help me out? I've been spending a lot of time with Windows environments lately through work so I'm probably rusty with OS X, but I'd appreciate some help in setting up Python correctly.

    Cossie
     
  2. cossie thread starter macrumors member

    Joined:
    Aug 8, 2006
    #2
    I came up with a bit of a workaround, I've installed Eclipse, setup the PyDev plugin and set the 3.1 install as the interpreter for PyDev.
     
  3. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #3
    Instead of typing 'python' in a Terminal window, type (or copy and paste) the following two commands:
    Code:
    echo "$PATH"
    which python
    
    Paste the output in a forum post.
     
  4. brainysmurf macrumors newbie

    Joined:
    Jan 10, 2010
    #4
    This is the default bahavior

    Since 3.1 is not backwards-compatible, to use 3.1 you have to type python3 in the terminal. If you want 2.5 then just type python (or you could type python2.5). If you try changing what typing python does, you could break Apple software, so don't even try it!
     
  5. cossie thread starter macrumors member

    Joined:
    Aug 8, 2006
    #5
    I tried 'python3' in the terminal and that gives me the latest version I installed, thanks for the explanation BrainySmurf :)
     
  6. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #6
    Actually... there IS an officially supported way to make the default python in Terminal version 3, without breaking Apple software in the process. There's a little shell script that came with your Python download. Look in your Python 3.1 folder, inside Applications.
     

Share This Page