OS X install confusion

J

John Fisher

Hi Groupies,

I have an Intel Macbook running OS X 10.4.

It came installed with Python 2.3.5. I have since installed MacPython
with version 2.4.4, cool.

When I open a bash terminal session and type python, it brings up
version 2.3.5. If I type IDLE it brings up version 2.4.4.

My question: what do I have to do to get it to bring up 2.4.4 with the
"python" command?

Thanks for bringing light to my ignorance.

JF
 
K

Kevin Walzer

John said:
Hi Groupies,

I have an Intel Macbook running OS X 10.4.

It came installed with Python 2.3.5. I have since installed MacPython
with version 2.4.4, cool.

When I open a bash terminal session and type python, it brings up
version 2.3.5. If I type IDLE it brings up version 2.4.4.

My question: what do I have to do to get it to bring up 2.4.4 with the
"python" command?

Thanks for bringing light to my ignorance.

JF

Sounds like a path problem. Apple's system Python is installed in
/usr/bin. Your installation is probably in /usr/local/bin. Edit your
profile or use the full path.
 
T

Ted

Sounds like a path problem. Apple's system Python is installed in
/usr/bin. Your installation is probably in /usr/local/bin. Edit your
profile or use the full path.

The default python on tiger (2.3.5) is sym-linked to /usr/bin/python
and /usr/bin/pythonw.

I found it easier to relink to the new installation path. This also
leaves /usr/bin/python23 and /usr/bin/pythonw23 still linked to the
original version if you want to quickly check something.

Cheers,
Ted
 
J

John Fisher

Ted said:
The default python on tiger (2.3.5) is sym-linked to /usr/bin/python
and /usr/bin/pythonw.

I found it easier to relink to the new installation path. This also
leaves /usr/bin/python23 and /usr/bin/pythonw23 still linked to the
original version if you want to quickly check something.

Cheers,
Ted

OK, please give a little more information how I can accomplish this
"re-link".

Thanks,

JF
 
P

Paul McNett

John said:
OK, please give a little more information how I can accomplish this
"re-link".

Your Python 2.5 is likely installed here:

/Library/Frameworks/Python.framework/Versions/Current/bin

But OS X comes with a "system Python", version 2.3.5, likely installed here:

/usr/bin

If you look at /usr/bin, you'll see:

lrwxr-xr-x 1 root wheel 9 Jan 31 17:24 python -> python2.3
lrwxr-xr-x 1 root wheel 72 Jan 31 17:24 python2.3 ->
.../../System/Library/Frameworks/Python.framework/Versions/2.3/bin/python
lrwxr-xr-x 1 root wheel 10 Jan 31 17:24 pythonw -> pythonw2.3
-rwxr-xr-x 1 root wheel 29704 Aug 19 2006 pythonw2.3

So, python is linked to python2.3, and python2.3 is in turn linked to
/System/Library/Frameworks/Python.framework/Versions/2.3/bin/python

You need to (warning: watch for line wrap):

sudo -s
<enter your password>
cd /usr/bin
ln -s /Library/Frameworks/Python.framework/Versions/Current/bin/python
python_current
ln -s /Library/Frameworks/Python.framework/Versions/Current/bin/pythonw
pythonw_current
rm python
rm pythonw
ln -s python python_current
ln -s pythonw pythonw_current

However, that isn't what I did. I like the system being able to find and
use the system-installed python, but I like my scripts to use the python
version I installed (2.5). To get that, skip the above symlinking and
instead edit your .bash_profile file (hidden file inside your home
directory) and put these lines at the top:

PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}
export PATH
 
7

7stud

Hi Groupies,

I have an Intel Macbook running OS X 10.4.

It came installed with Python 2.3.5. I have since installed MacPython
with version 2.4.4, cool.

When I open a bash terminal session and type python, it brings up
version 2.3.5. If I type IDLE it brings up version 2.4.4.

My question: what do I have to do to get it to bring up 2.4.4 with the
"python" command?

Thanks for bringing light to my ignorance.

JF

Strange. I installed macpython 2.4.4 on an imac this year, and when I
type python on the command line of a bash shell, python 2.4.4 starts
up:

$ python
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

I looked in:

/System/Library/Frameworks/Python.framework/Versions/Current/bin/

and inside that directory are the programs:

idle
pydoc
python
python2.3

So I tried typing python2.3 on the command line, and lo and behold
python 2.3.5 started up:

$ python2.3
Python 2.3.5 (#1, Jul 25 2006, 00:38:48)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
So it looks like the macpython install changed the name of the pre-
installed python program from python to python2.3. What do you see in
that directory?
 
7

7stud

Your Python 2.5 is likely installed here:

/Library/Frameworks/Python.framework/Versions/Current/bin

But OS X comes with a "system Python", version 2.3.5, likely installed here:

/usr/bin

If you look at /usr/bin, you'll see:

lrwxr-xr-x 1 root wheel 9 Jan 31 17:24 python -> python2.3
lrwxr-xr-x 1 root wheel 72 Jan 31 17:24 python2.3 ->
../../System/Library/Frameworks/Python.framework/Versions/2.3/bin/python
lrwxr-xr-x 1 root wheel 10 Jan 31 17:24 pythonw -> pythonw2.3
-rwxr-xr-x 1 root wheel 29704 Aug 19 2006 pythonw2.3

So, python is linked to python2.3, and python2.3 is in turn linked to
/System/Library/Frameworks/Python.framework/Versions/2.3/bin/python

You need to (warning: watch for line wrap):

sudo -s
<enter your password>
cd /usr/bin
ln -s /Library/Frameworks/Python.framework/Versions/Current/bin/python
python_current
ln -s /Library/Frameworks/Python.framework/Versions/Current/bin/pythonw
pythonw_current
rm python
rm pythonw
ln -s python python_current
ln -s pythonw pythonw_current

However, that isn't what I did. I like the system being able to find and
use the system-installed python, but I like my scripts to use the python
version I installed (2.5). To get that, skip the above symlinking and
instead edit your .bash_profile file (hidden file inside your home
directory) and put these lines at the top:

PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}
export PATH

When I installed macpython 2.4.4, I think the install automatically
changed the file: Users/me/.bash_profile. Here is what is says at the
bottom of .bash_profile:

# Setting PATH for MacPython 2.5 (these lines added by install)
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:$
{PATH}"
export PATH


(Note I installed macpython 2.4.4 but the comment says something about
python 2.5.)

Ahh, I think I know what happened to the op's install. I don't think
imacs come with the file: Users/me/.bash_profile. I had previously
created the .bash_profile file in order to alter the bash prompt, so
when I installed macpython 2.4.4, the install modified the pre-
existing .bash_profile file and added the lines listed above. I bet
the op didn't have a .bash_profile file on his system, so the install
didn't make the path changes for him/her.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,298
Messages
2,571,542
Members
48,283
Latest member
RitaVui655

Latest Threads

Top