Upgrade Python on a Mac

R

Rey Bango

Hi,

I'd like to upgrade the installed version of Python that came standard
on OS X (Leopard) with either 2.6.1 or 3.0.1. Before I stick my foot
in it, I just wanted to get a better understanding of the process.

If I download the disk image installer from here: http://www.python.org/download/
will it allow me to upgrade my existing version or is it more involved
(eg: making a new build).

I've looked through the python.org page for upgrade instructions for a
Mac and haven't found it.

Any help would be appreciated.

Rey...
 
K

Kevin Walzer

Rey said:
Hi,

I'd like to upgrade the installed version of Python that came standard
on OS X (Leopard) with either 2.6.1 or 3.0.1. Before I stick my foot
in it, I just wanted to get a better understanding of the process.

If I download the disk image installer from here: http://www.python.org/download/
will it allow me to upgrade my existing version or is it more involved
(eg: making a new build).

I've looked through the python.org page for upgrade instructions for a
Mac and haven't found it.

Any help would be appreciated.

Rey...

The Python.og installer will not update the system version of Python
installed on the Mac--that's maintained by Apple and should not be
touched. Instead, the installer will put in a new version alongside the
Apple version.

--Kevin
 
W

Wes James

Hi,

I'd like to upgrade the installed version of Python that came standard
on OS X (Leopard) with either 2.6.1 or 3.0.1. Before I stick my foot
in it, I just wanted to get a better understanding of the process.

I'd recommend you put your new versions in to /usr/local

Leave the OS X one alone.

-wj
 
N

Ned Deily

I'd like to upgrade the installed version of Python that came standard
on OS X (Leopard) with either 2.6.1 or 3.0.1. Before I stick my foot
in it, I just wanted to get a better understanding of the process.

If I download the disk image installer from here:
http://www.python.org/download/
will it allow me to upgrade my existing version or is it more involved
(eg: making a new build).

I've looked through the python.org page for upgrade instructions for a
Mac and haven't found it.

The python.org OS X installers install a self-contained version of
python for each major version of python, i.e. the 2.6.x installers
install or upgrade python2.6, 3.0.x -> python3.0. They do not interfere
with or disturb the Apple-supplied 2.5.x version. Multiple versions of
python can co-exist on OS X. See, for instance:
<http://permalink.gmane.org/gmane.comp.python.apple/15546>
 
M

MRAB

Rey said:
Hi,

I'd like to upgrade the installed version of Python that came standard
on OS X (Leopard) with either 2.6.1 or 3.0.1. Before I stick my foot
in it, I just wanted to get a better understanding of the process.

If I download the disk image installer from here: http://www.python.org/download/
will it allow me to upgrade my existing version or is it more involved
(eg: making a new build).

I've looked through the python.org page for upgrade instructions for a
Mac and haven't found it.

Any help would be appreciated.
The current recommendation is 2.x until 3.x has reached 3.1, unless you
want to try out 3.0.1 so you're ready for when 3.1 arrives.
 
R

Rey Bango

Thank you Kevin (& all who replied). The next question (which I think
will be my last until I've read more info) is:

Once installed, how will I be able to distinguish between the OSX
Apple-supplied, preinstalled version and the newly installed version
that I downloaded from Python.org? Currently, when I go to Terminal
and type in Python, it gives me the Apple-supplied variant. Will I
need to adjust my environment settings to be able to work with the
newly installed version?

Rey...
 
R

Robert Kern

Thank you Kevin (& all who replied). The next question (which I think
will be my last until I've read more info) is:

Once installed, how will I be able to distinguish between the OSX
Apple-supplied, preinstalled version and the newly installed version
that I downloaded from Python.org? Currently, when I go to Terminal
and type in Python, it gives me the Apple-supplied variant. Will I
need to adjust my environment settings to be able to work with the
newly installed version?

The installer should update your $PATH environment variable to put the newly
installed python executable before the system's if you use the bash shell. For
example, it added this to my ~/.bash_profile file:

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


If you use a different shell, you may need to edit the appropriate file to add
the above to the $PATH.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
R

Rey Bango

Thank you Robert. Since I'm using a ~/.profile file instead of a
~/.bash_profile file, I guess the installer didn't update it. I just
updated the path like you mentioned and now the new version of Python
comes up.

Rey...
 
P

Python Nutter

from my .profile file in ~

# This file does not get executed because .bash_profile exists in the
home directory
# and that gets executed instead. If .bash_profile did not exist then
this file gets executed

# PN hand edit export PATH to process the most recently installed
Python Framework
# otherwise the default Apple Python 2.5.1 that comes with Leopard
10.5.x would be called
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
# Finished exporting PATH to run most recently installed Python Framework

now I also have a .bash_profile in ~ but I've decommissioned it and
just renamed it with my initials at the end, this had:

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



as you know, the framework pythons go into:
/Library/Frameworks/Python.framework/Versions/

and thats how all the different versions get installed on OS X at the same time

I
f you have ever looked at your Mac’s root directory and wondered what
some of those other directories are for, you’re probably not alone.
Mac OS got a whole lot more complex with the advent of OS X, adapting
a unix file structure from Free BSD Unix that is largely unfamiliar to
Mac OS 9 and Windows users. So just what is /System, /Library, /usr,
and all the others for anyway? Here’s a brief explanation of each
directory as found in Mac OS X.


By default, if you look in the root of your Mac’s hard disk you’ll see
some unfamiliar sounding directories. From the command line, you will
see even more if you type ls /. Explained in no particular order:

/Applications = Self explanatory, this is where your Mac’s applications are kept

/Developer = The Developer directory appears only if you have
installed Apple’s Developer Tools, and no surprise, contains developer
related tools, documentation, and files.

/Library = Shared libraries, files necessary for the operating system
to function properly, including settings, preferences, and other
necessities (note: you also have a Libraries folder in your home
directory, which holds files specific to that user).

/Network = largely self explanatory, network related devices, servers,
libraries, etc

/System = System related files, libraries, preferences, critical for
the proper function of Mac OS X

/Users = All user accounts on the machine and their accompanying
unique files, settings, etc. Much like /home in Linux

/Volumes = Mounted devices and volumes, either virtual or real, such
as hard disks, CD’s, DVD’s, DMG mounts, etc

/ = Root directory, present on virtually all UNIX based file systems.
Parent directory of all other files

/bin = Essential common binaries, holds files and programs needed to
boot the operating system and run properly

/etc = Machine local system configuration, holds administrative,
configuration, and other system files

/dev = Device files, all files that represent peripheral devices
including keyboards, mice, trackpads, etc

/usr = Second major hierarchy, includes subdirectories that contain
information, configuration files, and other essentials used by the
operating system

/sbin = Essential system binaries, contains utilities for system administration

/tmp = Temporary files, caches, etc

/var = Variable data, contains files whose contents change as the
operating system runs
 
D

Diez B. Roggisch

Wes said:
I'd recommend you put your new versions in to /usr/local

Certainly not. Instead, create framework builds. These install
themselves under /Library/Frameworks, instead of
/System/Library/Frameworks, where the shipped python lives.

Not using a FW-build will cost you a lot of features OSX-specific.

Diez
 
G

Graham Dumpleton

Hi,

I'd like to upgrade the installed version of Python that came standard
on OS X (Leopard) with either 2.6.1 or 3.0.1. Before I stick my foot
in it, I just wanted to get a better understanding of the process.

If I download the disk image installer from here:http://www.python.org/download/
will it allow me to upgrade my existing version or is it more involved
(eg: making a new build).

I've looked through the python.org page for upgrade instructions for a
Mac and haven't found it.

Any help would be appreciated.

Beware of the official Python binary installers for MacOS X if wanting
to do Python web development.

Based on feedback these installers have only been compiled for 32 bit
architectures. This makes them useless if you want to run mod_python
or mod_wsgi with Apache that comes with MacOS X as it runs as 64 bit
and relies on the Python framework having 64 bit, which these
installers do not provide.

If this is going to affect you, build from source code. Configure
options required would be, as an example:

../configure --prefix=/usr/local/python-3.0 \
--enable-framework=/usr/local/python-3.0/frameworks \
--enable-universalsdk=/ MACOSX_DEPLOYMENT_TARGET=10.5 \
--with-universal-archs=all

Note that not all MacPorts installers have been both 32/64 bit either.
Not sure if they have fixed this issue.

Graham
 
J

Jorgen Grahn

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

If you have ever looked at your Mac?s root directory and wondered what
some of those other directories are for, you?re probably not alone.
Mac OS got a whole lot more complex with the advent of OS X, adapting
a unix file structure from Free BSD Unix that is largely unfamiliar to
Mac OS 9 and Windows users.

It should be added that it looks very unfamiliar to Unix users too,
if your list below is correct.

\begin{whine}

Why is Python a "Framework" under "Libraries"? In any other Unix, a
third-party Python installation would have been placed in /usr/local/
or /opt/. Also, editing a user's dotfiles while installing software
seems cruel and unusual -- to that user, and to the other users for
whom the newly installed software "doesn't work".

\end{whine}
So just what is /System, /Library, /usr,
and all the others for anyway? Here?s a brief explanation of each
directory as found in Mac OS X.

[snip]

/Jorgen
 
A

Aahz

\begin{whine}

Why is Python a "Framework" under "Libraries"? In any other Unix, a
third-party Python installation would have been placed in /usr/local/
or /opt/. Also, editing a user's dotfiles while installing software
seems cruel and unusual -- to that user, and to the other users for
whom the newly installed software "doesn't work".

\end{whine}

Because that's what Apple wants. :-/
 
7

7stud

Beware of the official Python binary installers for MacOS X if wanting
to do Python web development.

Based on feedback these installers have only been compiled for 32 bit
architectures. This makes them useless if you want to run mod_python
or mod_wsgi with Apache that comes with MacOS X as it runs as 64 bit
and relies on the Python framework having 64 bit, which these
installers do not provide.

If this is going to affect you, build from source code. Configure
options required would be, as an example:

./configure --prefix=/usr/local/python-3.0  \
 --enable-framework=/usr/local/python-3.0/frameworks \
 --enable-universalsdk=/ MACOSX_DEPLOYMENT_TARGET=10.5 \
 --with-universal-archs=all


Which of the following is the "official Python binary installer for
MacOS X"?
 
G

Graham Dumpleton

Which of the following is the "official Python binary installer for
MacOS X"?

I am talking about the binary dmg installer. Although the source by
default only installs 32 bit as well when compiled.

This issue affects all versions available.

Graham
 

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
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top