By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,821 Members | 1,075 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,821 IT Pros & Developers. It's quick & easy.

Re: Teething troubles with Python on a Mac

P: n/a
Thomas Philips wrote:
Question 1: How can I locate the Python installation? There a few
files under Applications MacPython 2.5, but this is clearly not the
entire installation.
Have a look in

/Library/Frameworks/Python.framework/Versions/2.5
But I do not seem to
be able to see the sequence of folders under the horizontal scroll bar
in any finder window. What do I need to do to make the folder sequence
visible in all Finder Windows?
You can't -- this feature only exists in the Search window,
which is a different kind of window from the normal Finder
windows.

However, in a normal Finder window, if you click and hold
with the Command key on the title displayed in the title
bar at the top of the window, you'll get a pop-up menu
showing the position of the folder you're looking at in the
nesting hierarchy.
Item 2. I downloaded and installed the SciPy superpack from
Macinscience,org. Scipy seems to import correctly into the Python
2.5.1 that comes with the Mac, but i cannot import it into MacPython
2.5.2.
I'm not familiar with SciPy distributions, but if it's some
sort of double-clickable installer, it's likely that it's only
designed to install into the system Python (i.e. the one that
comes installed with MacOSX).

See if it has installed anything into

/Library/Python/2.5/site-packages

If so, you could try moving or copying them into

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
Question 5. How can I find the current value of the PYTHONPATH
environment variable, and how can I edit it and add a directory in
which I keep my Python programs.
To find out its current value, in a Terminal window,

echo $PYTHONPATH

To have it set each time you open a Terminal window,
one way is to put something like this in your ~/.bashrc
file:

PYTHONPATH=whatever_you_want
export PYTHONPATH

However, because the filename starts with a dot, it
won't show up in the Finder or any Save dialog boxes,
making it a bit tricky to edit with a GUI-based text
editor. There's some advice here on how to deal with
that:

http://discussions.apple.com/thread....readID=1007602
Question 6. Apparently there's a Property List Editor that must be
used to create a file called ~ /.MacOSX/environment.plist. I can't
find a directory called ~/.MacOSX. Is this a hidden directory?
I've never tried that method myself, but it sounds
plausible. You'll have similar difficulties with the
name .MacOSX not showing up in the Finder. However,
you can get to it using the "Go To Folder..." command
under the "Go" menu in the Finder and typing in the
full pathname.

If there isn't already an environment.plist file
there, you may have to save it somewhere else first
and then drag it into the .MacOSX folder.

The Property List Editor comes with the Developer
Tools and lives in /Developer/Applications/Utilities.
Item 4. I opened a terminal window, and typed ipython. Here's what I
got:

/Users/tom/.ipython
WARNING:
Installation error. IPython's directory was not found.
It's quite likely that this will correct itself once you
get the relevant files into the right site-packages folder.

Also, if this is your only reason for wanting to set
PYTHONPATH, you may not have to worry about that either.
I never thought I'd say this, but it actually seemed a lot easier to
get Python and any associated programs up and running on Windows! I
suspect that a large fraction of my troubles are due to the fact that
I am brand new to the Mac and to Unix, but I bought the Mac in part
because I thought that using it was effortless.
It's generally pretty smooth (although different from Windows
in many ways, so you do need to learn some new things) as
long as you stick to GUI-style applications. Python doesn't
quite fit into that way of working, however. You need to
know a bit about what's going on underneath, particularly
when managing your own Python installation.

The way I approach Python on MacOSX is to treat it as a
Unix system and use the standard Python method of installing
packages, i.e. use Python to run a setup.py file. This
ensures that the package will be installed into whichever
Python is being used to run the setup.py.

Apart from the initial installation of Python itself, I
never use an installer to install a Python package if I
can avoid it. I wouldn't trust it to install into the right
Python version.

--
Greg
Aug 3 '08 #1
Share this Question
Share on Google+
7 Replies

P: n/a
Avi
Apart from the initial installation of Python itself, I
never use an installer to install a Python package if I
can avoid it. I wouldn't trust it to install into the right
Python version.
On that: how would I go about updating the system Python, then? Or is
that going to be stuck at whatever it is, and Mac users are expected
to run two simultaneous Python installations? I'm not entirely
comfortable with having a separate MacPython (I used to do so, but it
caused so many issues with installing new packages that I gave up on
it) and would prefer to just update system Python.

- Avi
Aug 3 '08 #2

P: n/a
On Sun, Aug 3, 2008 at 12:37 AM, Avi <av*********@gmail.comwrote:
>Apart from the initial installation of Python itself, I
never use an installer to install a Python package if I
can avoid it. I wouldn't trust it to install into the right
Python version.

On that: how would I go about updating the system Python, then? Or is
that going to be stuck at whatever it is, and Mac users are expected
to run two simultaneous Python installations? I'm not entirely
comfortable with having a separate MacPython (I used to do so, but it
caused so many issues with installing new packages that I gave up on
it) and would prefer to just update system Python.

- Avi
--
http://mail.python.org/mailman/listinfo/python-list
You will likely cause more problems updating the system python than
managing the two separate installations. OSX relies on the version of
python they ship. While there are likely cases where it could be
replaced completely safely the risks of having to re-install your OS
at some point because it has the wrong version of python are not worth
it.

--
Stand Fast,
tjg. [Timothy Grant]
Aug 3 '08 #3

P: n/a
You will likely cause more problems updating the system python than
managing the two separate installations.
That's sadly worrying.
OSX relies on the version of python they ship.
I think that helps my point--there *are* bug fixes between major
versions despite the new language changes, and that can really only be
a good thing.
While there are likely cases where it could be
replaced completely safely the risks of having to re-install your OS
at some point because it has the wrong version of python are not worth
it.

I haven't been a Mac user long enough to see a major version change (I
was on Linux/XP/Vista for most of 2.4 and switched distributions right
after 2.5 came out, and then XP before that), so I've never seen a
version change, but is this the sort of thing that will be upgraded in
Software Update?

- Avinash

Aug 3 '08 #4

P: n/a
On Sun, Aug 3, 2008 at 10:44 AM, Avinash Vora <av*********@gmail.comwrote:
>You will likely cause more problems updating the system python than
managing the two separate installations.

That's sadly worrying.
>OSX relies on the version of python they ship.

I think that helps my point--there *are* bug fixes between major versions
despite the new language changes, and that can really only be a good thing.
>While there are likely cases where it could be
replaced completely safely the risks of having to re-install your OS
at some point because it has the wrong version of python are not worth
it.


I haven't been a Mac user long enough to see a major version change (I was
on Linux/XP/Vista for most of 2.4 and switched distributions right after 2.5
came out, and then XP before that), so I've never seen a version change, but
is this the sort of thing that will be upgraded in Software Update?

- Avinash
I haven't paid enough attention to the system python in my four years
as an Apple user to know. I simply installed the python I wanted and
went from there.

I honestly don't think it is a cause for concern though. The situation
is very similar to on Linux (Red Hat has their version of python) you
simply install what you want and use it.

--
Stand Fast,
tjg. [Timothy Grant]
Aug 3 '08 #5

P: n/a
Avi wrote:
On that: how would I go about updating the system Python, then?
The usual advice is not to try to do that at all.
Generally it's best to treat anything in /System
as off-limits.
(I used to do so, but it
caused so many issues with installing new packages that I gave up on
it)
I've very rarely had any problem with maintaining my
own Python installation, but as I said, I always install
packages using "python setup.py".

Python itself copes very well with having multiple
versions installed, on all platforms, but you have to
do things the Python way.

--
Greg
Aug 4 '08 #6

P: n/a
(Greg: You only sent the email to me: you probably wanted to add the
mailing list to the recipients.)

On Aug 4, 2008, at 8:37 AM, greg wrote:
Avi wrote:
>On that: how would I go about updating the system Python, then?

The usual advice is not to try to do that at all.
Generally it's best to treat anything in /System
as off-limits.
Right, but I meant if there is an Apple-sanctioned way. I guess not?
>(I used to do so, but it
caused so many issues with installing new packages that I gave up on
it)

I've very rarely had any problem with maintaining my
own Python installation, but as I said, I always install
packages using "python setup.py".
I guess I'll give it a shot, then. Alias in bash to MacPython, I
assume?
Python itself copes very well with having multiple
versions installed, on all platforms, but you have to
do things the Python way.
My point was that it seems to be a bit of a hack.

Thanks for the advice from everyone, though.

--
Avi

Aug 4 '08 #7

P: n/a
Avinash Vora wrote:
(Greg: You only sent the email to me: you probably wanted to add the
mailing list to the recipients.)
I replied to the newsgroup as well, so it should
turn up in the list.
Right, but I meant if there is an Apple-sanctioned way. I guess not?
Not that I'm aware of.
I guess I'll give it a shot, then. Alias in bash to MacPython, I assume?
You'll probably find that the MacPython installer has set
things up so that simply running "python" in the shell
will get the version it has installed. Check the version
number displayed in the banner when you run it.

If it's not the right one, you could make a symlink
from /usr/bin/python to the one you want (by default it's
symlinked to the system python).

--
Greg
Aug 5 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.