I'm using Mac OSX 10.6.8 Snow Leopard and I think I've got everything I need to install Python 3.3.2, but when I type python
into Terminal it still says I have 2.6.1. This is because it can't find the path to the newer version, and this should be fixed by adding the following to .bash_profile:
PATH="/Library/Frameworks/Python.framework/Versions/3.3.2/bin:${PATH}"
export PATH
I've already done it (and run the cat
command on it several times just to check), but it keeps saying the same thing. I suppose my .bash_profile file and/or Python 3.3.2 folder might not be in the right directories? .bash_profile is in /Users/mac
(home) and the Python folder is in /Library/Frameworks/Python.framework/Versions
. Should they be somewhere else?
Thanks in advance!
Use python3
to run python3
, and also restart your shell after modifying .bash_profile
or do source .bash_profile
to load the new settings without restarting the shell.
$ which python3
/usr/bin/python3
Example:
$ cat so.py
#!/usr/bin/python3
print("hello, world!")
$ chmod +x so.py
$ ./so.py
hello, world!