473,326 Members | 2,048 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,326 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 2423
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.