I think I've installed Python 2.7.3 according to the instructions in the README, and now want to use that version.
However, when typing "python" in Terminal, I get "Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) ".
So:
(1) I can't seem to find where the new software has gone and
(2) can't seem to find how to point to this new versoin.
I've searched Python.org and with Google but
[I'm on Mac OS X 10.7.4]
Please help.
Bob, I'm coming into this late, but it doesn't appear that you've
< gotten a satisfactory answer yet. Let's take it one step at a time.
First, if none of the hints you've received earlier have gotten you going.
Maybe the thing is to resort to a bigger hammer. In a terminal window:
$sudo find / -name Python -print<return>
This will search the entire file system for all the files named Python
Trouble is, the file you're looking for is named "python" and this
command is case-sensitive. So the command you need would be:
sudo find / -name python -print
and will ask for your admin password so it can search in directories
owned by root.
The file you're looking for is in a directory that you can read
with more mundane permissions, so you might want to leave off
the "sudo" prefix. If you do, you'll get some message about
permission problems.
(It may also generate quite a bit of output, so you might want
to capture it in a file.)
For example:
find / -name python > /tmp/pythons.txt 2> /dev/null
The 2>/dev/null bit throws away warnings about permission problems
and the like.
Alternatively, you can cut down the output like so:
find / -name python -print | grep bin/python
That will only report pythons found in directories named "bin".
On my laptop, that cuts the output down to:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/opt/local/bin/python
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python
/usr/bin/python
/usr/local/bin/python
Those are all valid python interpreters, or wrappers for same.
In any case, this will take several minutes and while it is running,
you can be checking a couple of other things. OS X doesn't use a
.bashrc file by default (you can make it do so if you want, but
that's extra work right now). It uses .login and then .profile
to set up your python path _if_ you've used the installer from python.org.
I doubt it. What files are used, depends on which shell you use.
Bash uses .profile; the C shell uses .login and .cshrc.
I don't think there is a shell that can read both .login and .profile
since .login typically uses C shell syntax and .profile uses Bourne
shell syntax.
If you're not sure which shell you have, type
echo $SHELL
at the shell prompt.
So, look to see if you have a .profile in your ~ directory. If so,
then you're using (or have used at some point in the past) an installer
from python.org.
It should have an entry that looks something like the following:
# Setting PATH for Python 2.7
# The original version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
Note the distinction between this path and the one from Apple.
The python that ships from Apple is in /System/Library/Frameworks…
Do NOT touch the one from Apple. Apple uses it for some of its
housekeeping operations and you want it to stay just as Apple
installed it.
+1
When you finally find the Python 2.7 in the output from the "find"
command, you can edit your .login (if you don't have a .profile) or
edit .profile if you do.
Hope this helps,
-- HansM