473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

python on Mac

I just purchased a new macbook (os 10.4.6), and I'm trying to install
python 2.4 on it. I downloaded and ran the two installers recommended
at http://www.python.org/download/mac/. Now I have IDLE, which runs
2.4.1, but typing "python" at a terminal still opens 2.3.5, because it
points to /usr/bin/python. Is there a way to run python 2.4 without
idle? If I want to do a unix style script, something like
#!/usr/bin/python
print "hello world"
what can I put on the first line that will cause python 2.4 to
interpret my code?

Thanks a lot.
THN

Apr 6 '06 #1
16 2432
Thomas Nelson wrote:
I just purchased a new macbook (os 10.4.6), and I'm trying to install
python 2.4 on it. I downloaded and ran the two installers recommended
at http://www.python.org/download/mac/. Now I have IDLE, which runs
2.4.1, but typing "python" at a terminal still opens 2.3.5, because it
points to /usr/bin/python. Is there a way to run python 2.4 without
idle? If I want to do a unix style script, something like
#!/usr/bin/python
print "hello world"
what can I put on the first line that will cause python 2.4 to
interpret my code?

Thanks a lot.
THN


The python in /usr/bin is a link (to a link). You can do this:

sudo rm /usr/bin/python
sudo ln -s \
/System/Library/Frameworks/Python.framework/Versions/2.4/bin/python \
/usr/bin/python
This stupid firebird editor word-wraps (and I don't know how to turn
this completely annoying behavior off. Appearantly this is because it is
impossible to soft wrap text on the reader side, annoying NNTP veterans
everywhere--we just can't count on this hard to program behavior in most
mail readers because its so impossible to program for. Its been this way
since reader-client word wrapping was predicted to exist at MIT in the
1970's.) so get a unix guru to help you with that last command if you
really don't know what's going on.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Apr 6 '06 #2
There is no 2.4 in my Versions folder, only 2.3 and current. Should
one of the installers have created this directory? Which one?

THN

Apr 6 '06 #3
Thomas Nelson <th*@mail.utexas.edu> wrote:
...
at http://www.python.org/download/mac/. Now I have IDLE, which runs


Darn, that page needs to be fixed -- it's out of date!-( Sorry...

See instead <http://www.python.org/download/releases/2.4.3/> and
download
<http://www.python.org/ftp/python/2.4.3/Universal-MacPython-2.4.3.dmg>,
you should be much happier.
Alex
Apr 6 '06 #4
Thanks to you both. I downloaded the dmg suggested, and trustingly
typed:
sudo rm /usr/bin/python
sudo ln -s /usr/local/bin/python2.4 /usr/bin/python
And now my command line and scripts behave the way I expect. Thanks
again.

THN

Apr 6 '06 #5
You removed /usr/bin/python! This is a really bad idea. You should
never modify /usr/bin because the system is expecting it. This is why
the new installation is in /usr/local/bin.

Modify your /usr/local instead are change your .login file instead. It
is much safer.

Apr 6 '06 #6
James Stroud wrote:
Thomas Nelson wrote:
I just purchased a new macbook (os 10.4.6), and I'm trying to install
python 2.4 on it. I downloaded and ran the two installers recommended
at http://www.python.org/download/mac/. Now I have IDLE, which runs
2.4.1, but typing "python" at a terminal still opens 2.3.5, because it
points to /usr/bin/python. Is there a way to run python 2.4 without
idle? If I want to do a unix style script, something like
#!/usr/bin/python
print "hello world"
what can I put on the first line that will cause python 2.4 to
interpret my code?

Thanks a lot.
THN


The python in /usr/bin is a link (to a link). You can do this:

sudo rm /usr/bin/python
sudo ln -s \
/System/Library/Frameworks/Python.framework/Versions/2.4/bin/python \
/usr/bin/python


No, for the love of all that is holy, don't do that! OS X depends on stuff in
/usr/bin/. Don't pull the carpet out from under your OS!

The python executables from the Python 2.4 installer are installed to
/usr/local/bin/. I believe that the Universal binary that Alex linked to takes
care of adjusting the PATH environment variable such that this is exposed.

--
Robert Kern
ro*********@gmail.com

"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

Apr 6 '06 #7
Robert Kern wrote:
James Stroud wrote:

The python in /usr/bin is a link (to a link). You can do this:

sudo rm /usr/bin/python
sudo ln -s \
/System/Library/Frameworks/Python.framework/Versions/2.4/bin/python \
/usr/bin/python


No, for the love of all that is holy, don't do that! OS X depends on stuff in
/usr/bin/. Don't pull the carpet out from under your OS!


C.f.:

"FAQ 5.7 Describe Apple's Framework implementation of Python and how that
affects me adding new Python implementations"

http://pythonmac.org/wiki/FAQ#head-3...94759989464b5a
--
Robert Kern
ro*********@gmail.com

"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

Apr 6 '06 #8
In article <e1**********@daisy.noc.ucla.edu>,
James Stroud <js*****@ucla.edu> wrote:
Thomas Nelson wrote:
I just purchased a new macbook (os 10.4.6), and I'm trying to install
python 2.4 on it. I downloaded and ran the two installers recommended
at http://www.python.org/download/mac/. Now I have IDLE, which runs
2.4.1, but typing "python" at a terminal still opens 2.3.5, because it
points to /usr/bin/python. Is there a way to run python 2.4 without
idle? If I want to do a unix style script, something like
#!/usr/bin/python
print "hello world"
what can I put on the first line that will cause python 2.4 to
interpret my code?

Thanks a lot.
THN


The python in /usr/bin is a link (to a link). You can do this:

sudo rm /usr/bin/python
sudo ln -s \
/System/Library/Frameworks/Python.framework/Versions/2.4/bin/python \
/usr/bin/python


YIKES! Don't do that. Don't mess with Apple's python. Not
recommended. Check the MacPython FAQ and Wiki pages. Python 2.4 was
installed in /usr/local/bin. You should put that in your $PATH variable
Before /usr/bin. That will cause the new Python to be launched.

-- Lou Pecora (my views are my own) REMOVE THIS to email me.
Apr 6 '06 #9

Lou Pecora wrote:
YIKES! Don't do that. Don't mess with Apple's python. Not
recommended. Check the MacPython FAQ and Wiki pages. Python 2.4 was
installed in /usr/local/bin. You should put that in your $PATH variable
Before /usr/bin. That will cause the new Python to be launched.


some afterthoughts:

- look at Oreilly's "OS X Tiger for Unix Geeks" before you do anything
that'll break OS X. Just in case you get the idea to upgrade the perl
that OS X installed, don't remove the one in /usr/bin either.

- investigate the Activestate disk image for OS X/Intel. I say
"investigate" cause i don't have any experience with OS X/Intel, but
the Activestate releases i've used for Windows and OS X in the past
have all been very high quality.

Apr 6 '06 #10
Well, as I stated in post, I've already replaced the link at
/usr/bin/python. I'm not clear why that's unhealthy. Should I change
it back to whatever it was before? I guess maybe it was
/System/Library/Frameworks/Python.framework/Versions/Current/bin/python
?
Thanks,
THN

Apr 6 '06 #11
Thomas Nelson wrote:
Well, as I stated in post, I've already replaced the link at
/usr/bin/python. I'm not clear why that's unhealthy.
The FAQ describes why it's unhealthy in detail.

"FAQ 5.7 Describe Apple's Framework implementation of Python and how that
affects me adding new Python implementations"

http://pythonmac.org/wiki/FAQ#head-3...94759989464b5a
Should I change
it back to whatever it was before? I guess maybe it was
/System/Library/Frameworks/Python.framework/Versions/Current/bin/python
?


[src]$ ls -l /usr/bin/python
lrwxr-xr-x 1 root wheel 9 May 1 2005 /usr/bin/python -> python2.3
[src]$ ls -l /usr/bin/python2.3
lrwxr-xr-x 1 root wheel 72 May 1 2005 /usr/bin/python2.3 ->
.../../System/Library/Frameworks/Python.framework/Versions/2.3/bin/python

--
Robert Kern
ro*********@gmail.com

"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

Apr 6 '06 #12
Ok, I fixed my /usr/bin/python and added /usr/public/bin/ to my PATH in
..profile. Everything seems ok now.
Thanks again to everyone for their help.

THN

Apr 6 '06 #13
In article <11**********************@i39g2000cwa.googlegroups .com>,
"pierreth" <pt*********@yahoo.ca> wrote:
You removed /usr/bin/python! This is a really bad idea


Is there any way to put it back, short of a full system reinstall?
Apr 7 '06 #14
Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealand> wrote:
In article <11**********************@i39g2000cwa.googlegroups .com>,
"pierreth" <pt*********@yahoo.ca> wrote:
You removed /usr/bin/python! This is a really bad idea


Is there any way to put it back, short of a full system reinstall?


There's a free 3rd party tool known as Pacifist to extract part-installs
from Apple's system DVDs, but I'm not sure how you'd apply it to Apple's
Python -- try asking around on the Pacifist mailing list or site...
Alex
Apr 10 '06 #15
In article <1h*****************************@yahoo.com>,
al*****@yahoo.com (Alex Martelli) wrote:
Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealand> wrote:
In article <11**********************@i39g2000cwa.googlegroups .com>,
"pierreth" <pt*********@yahoo.ca> wrote:
>You removed /usr/bin/python! This is a really bad idea


Is there any way to put it back, short of a full system reinstall?


There's a free 3rd party tool known as Pacifist to extract part-installs
from Apple's system DVDs...


So there's no simple equivalent of "rpm --replace-pkgs"?
Apr 11 '06 #16
Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealand> wrote:
In article <1h*****************************@yahoo.com>,
al*****@yahoo.com (Alex Martelli) wrote:
Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealand> wrote:
In article <11**********************@i39g2000cwa.googlegroups .com>,
"pierreth" <pt*********@yahoo.ca> wrote:

>You removed /usr/bin/python! This is a really bad idea

Is there any way to put it back, short of a full system reinstall?


There's a free 3rd party tool known as Pacifist to extract part-installs
from Apple's system DVDs...


So there's no simple equivalent of "rpm --replace-pkgs"?


Never heard of one, but you should double-check on Macintosh-related
groups, where you're more likely to find relevant expertise.
Alex
Apr 11 '06 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.