I have mac os x, recently I have install python version 3.2 before I had version 2.6.1. but when I type "python" in terminal it prints Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49). what does it mean? how can I use python 3.2 that have install this week?
-
I did and the result is: Tinas-MacBook-Pro:~ tina$ python3. -bash: python3.: command not found – sandra Nov 14 '13 at 19:47
-
@sandra Which version of Mac OS X are you sporting? – jwarner112 Nov 14 '13 at 19:48
-
rename the python3 executable to `python3` – IT Ninja Nov 14 '13 at 19:48
-
then make sure that it is in your path and you can just do `python3 *args...` – IT Ninja Nov 14 '13 at 19:48
-
How did you install python? (and I would use the current version python 3.3) – mmmmmm Nov 14 '13 at 19:49
-
@jwarner112 version 10.6.8 – sandra Nov 14 '13 at 19:49
-
just delete the python 2.6 version and then install python 3.2 – Saad Abdullah Nov 14 '13 at 19:50
-
1oh I made a mistake and put dot after python3 and type python3.! now i worked ;) – sandra Nov 14 '13 at 19:51
-
@ Saad Abdullah I tried to delete 2.6 but I was not successful I use "sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.6.1 " and also "sudo rm -rf "/Applications/Python 2.6"" but after this when I type python it print python 2.6.1. what should I do? – sandra Nov 14 '13 at 19:54
-
@sandra If you got your solution yourself, please make sure to answer your own question at the bottom and mark it as best answer. Also mark this as a community post. It may come in handy for future coders! – jwarner112 Nov 14 '13 at 19:56
-
@jwarner112 tnx for advise, I did it – sandra Nov 14 '13 at 20:00
-
@sandra Also mark it as best answer and mark the entire question as a community question. – jwarner112 Nov 14 '13 at 20:34
2 Answers
I'm on windows, but I'm hoping the solution will work cross-platform.
Your computer has something called environment variables. Basically, a list of locations with names on them like python installation path. Windows computers, and probably Mac ones too, use these to intercept commands in the terminal.
Likely, python is an environment variable in your machine but it points to your python-2.6.1 installation.
From what I'm reading, you can edit your environment variables at /etc/launchd.conf, re-assigning your environment variable python to point at Python 3.2 instead of Python 2.6.1.
I hope this works for you; I don't have Mac OS X, so I can't easily help you navigate or know what you're looking at! But, good luck!
And Happy Coding!
EDIT: Here's some more information about environment variables in OS X!
- 1
- 1
- 1,492
- 2
- 14
- 29