-1

I have downloaded latest Python version 3.5 on my Mac OSX 10.9.5. It is stored in Applications. If I type python --version in Terminal, I get Python 2.7.5 which is in directory /usr/bin/. How can I set path for Python 3.5?

Richard Erickson
  • 2,568
  • 8
  • 26
  • 39
stonebe
  • 482
  • 1
  • 3
  • 14
  • Possible duplicate of [How to set Python's default version to 3.3 in Mac?](http://stackoverflow.com/questions/18425379/how-to-set-pythons-default-version-to-3-3-in-mac) – Richard Erickson Apr 13 '16 at 12:32
  • Close, however I prefer no-alias solutions. – stonebe Apr 13 '16 at 13:05
  • If you want something more solid, even though it's more advanced, you should look into [homebrew](http://brew.sh) (package manager) to install python and , optionally, [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) to set up self-contained environments – ursan Apr 14 '16 at 02:48

1 Answers1

0

Follow below steps.

  1. Find the location of the new python
  2. delete the /usr/bin/python
  3. set export PATH=$PATH:$new_python_location
  4. Type python --version
Santhosh Tangudu
  • 759
  • 9
  • 19
  • How can I do step 2? I tried "rm -Rf python" resulting in "Permission denied". It seems that /usr/bin/python is protected (properties -rwxr-xr-x). – stonebe Apr 13 '16 at 12:57
  • execute sudo rm -rf /usr/bin/python – Santhosh Tangudu Apr 13 '16 at 15:54
  • I don't understand step 3: new python location is "/Applications/Python\ 3.5/". Do I have to enter "export python=$python:$/Applications/Python\ 3.5/"? Looks like I understood it wrong. – stonebe Apr 13 '16 at 20:15
  • we have to set the path of new python location. to set the python location, the command is: export PATH=$PATH:/Applications/Python\ 3.5/bin – Santhosh Tangudu Apr 14 '16 at 03:56
  • I don't succeed. I enter "export PATH=$PATH:/Applications/Python\ 3.5/bin" and no /usr/bin/python is generated. It is still missing. – stonebe Apr 15 '16 at 12:09
  • it will not generate /usr/bin/python. But if you type python --version, it will give the result. If you want to generate /usr/bin/python, you have to create symbolic link. – Santhosh Tangudu Apr 15 '16 at 12:43