Wiggles
Wiggles

Reputation: 125

Python versions gone after installing Python 3.3 via Macports

so I installed Python 3.3 via Macports, using port install python33

(Using OSX 10.8.2 ML)

Everything worked fine (at least it didn't put out any error message at the end)

So after this I wanted to select this specific python version via port select and first wanted to have a list of all available versions now with:

port select --list python

and this now only gives me a list of 3 option:

Available versions for python:
    None
    python27 (active)
    python33

before I installed python33, i had also the apple versions of python listed:

Available versions for python:
    none
    python25-apple
    python26-apple
    python27 (active)
    python27-apple

The Apple versions are still there (located at: /System/Library/Frameworks/Python.framework/Versions) they are just not listed any longer.

Does anyone know how to handle this? (Also, when I use the python command in the shell, it still uses the python27-apple version. When I wanted to change the version before, an error occurred. But that would be another question.)

EDIT (24.10.2012):

In the meantime I found out about the command:

port contents python_select

which gives out:

Port python_select contains:
    /opt/local/etc/select/python/base
    /opt/local/etc/select/python/none

Besides what is listed here, the folder contains these files:

drwxr-xr-x  8 admin  272 24 Okt 09:50 .
drwxr-xr-x  5 admin  170  4 Okt 15:05 ..
-rw-r--r--  1 wheel  363 23 Okt 17:18 base
lrwxr-xr-x  1 admin    8 23 Okt 18:05 current -> python27
-rw-r--r--  1 wheel   26 23 Okt 17:18 none
-rw-r--r--  1 wheel  398 23 Okt 23:27 python27
-rw-r--r--  1 wheel  384 23 Okt 17:21 python33

the python27 and 33 file are a simple text file with the following, same content (version No. differs):

bin/python2.7
bin/pythonw2.7
bin/python2.7-config
bin/idle2.7
bin/pydoc2.7
bin/smtpd2.7.py
bin/2to3-2.7
share/man/man1/python2.7.1
-
/opt/local/Library/Frameworks/Python.framework/Versions/2.7
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Headers
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python    

But that's it. I don't know what I can do with this information...

Upvotes: 4

Views: 4256

Answers (1)

Karel Kubat
Karel Kubat

Reputation: 1675

(Also, when I use the python command in the shell, it still uses the python27-apple version. When I wanted to change the version before, an error occurred. But that would be another question.)

This sounds like your search path isn't right. Edit your ~/.bashrc and near the end put in:

export PATH=/opt/local/bin:$PATH

If you want to have this system-wide, then edit /etc/bash.rc and put the PATH definition in there. You want to put it somewhere near the end, because the bash resources tend to redefine the PATH sometimes (so if you put it at the beginning, then chances are that the remaining configuration will change it).

Anyway, after the next terminal startup the command python should be resolved in /opt/local/bin/, and the python executable there should be a symlink to whichever port version you select.

Update: You can test which Python version your shell would select depending on your PATH setting using:

which python

This should print

/opt/local/bin/python

Upvotes: 1

Related Questions