-1

I'm on Mac OS X El Capitan, which comes with Python 2.7.10; I want to upgrade to 3.x.

I've downloaded the 64-bit version from the website and installed it through brew however whenever I type python --version into the terminal the version is always 2.7.10. I can make terminal run in 3.x by typing python3 but I need the system to run on python3 as I'm running code through Sublime. I've been told not to change the systems python code as it can mess up other applications so am pretty stumped on how to do it.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
reuben
  • 91
  • 1
  • 2
  • 12
  • 3
    The thing you need to fix, surely, is whatever is running code through Sublime. I'm sure there will be a setting in that app. – Daniel Roseman Nov 11 '16 at 13:58
  • http://stackoverflow.com/documentation/django/200/getting-started-with-django/3203/virtual-environment#t=201611111410298972616 – Alex Nov 11 '16 at 14:10
  • The word "upgrade" is pretty controversal... Basically, half Python programmers uses Python2, and the other half of them uses Python3. The main reason for this is that porting a code from Python2 to Python3 can become really hard. But still, half of the world uses Python2, is not planning to switch for Python3, and would probably have very little to gain from doing so. – Right leg Nov 11 '16 at 14:12
  • assuming that `python` is located at `/usr/bin/python`, it is probably a symlink to python2.7 , You can change that to python3.x – Alex Nov 11 '16 at 14:12
  • @DanielRoseman so the code is written in sublime but run through terminal , which is still in 2.7. The thing I'm finding difficult is making terminal run Sublime python files in Python3.x – reuben Nov 11 '16 at 14:19
  • 1
    @lxer - a great solution if you want to break all python 2 based programs on your system. If you don't want to break them, python 3 is happy to live side-by-side with python 2. – tdelaney Nov 11 '16 at 14:19
  • So Sublime has nothing to do with this at all? In which case why can't you just run `python3 my_file.py`? – Daniel Roseman Nov 11 '16 at 14:25
  • You probably want to look into multiple virtual environment support for different python project using sublime. http://stackoverflow.com/questions/24963030/sublime-text3-and-virtualenvs – mootmoot Nov 11 '16 at 18:07

1 Answers1

0

Try changing the default intepreter in sublime. And add a 3 in the shebang line like this:

#/usr/bin/evn python3.

If you really want to know the python3 version you have to type:

python3 --version

As other people said python(2) and python3, are the same but different(but still the same...)

dmb
  • 288
  • 2
  • 9