0

I have looked for Python 2.7.12 in my apps and docs but I can't find it... I'm using a macbook pro.
I can see Python 3.6 in my applications so I don't know why the terminal isn't referring to this one.

I want to get started learning django but I don't think it will be possible if I don't use Python 3.5 or later.

is there a way to tell the terminal to use 3.6 instead?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
John
  • 41
  • 1
  • 2
  • 8
  • Possible duplicate of [How to set Python's default version to 3.3 on OS X?](https://stackoverflow.com/questions/18425379/how-to-set-pythons-default-version-to-3-3-on-os-x) – Szymon Jun 18 '17 at 12:40
  • 2
    You can develop with 2.7 its really not a problem, I do it as well. Do you have a running project? what Version is it in? – hansTheFranz Jun 18 '17 at 12:41

4 Answers4

1

Open the text editor like nano , vim or gedit and open the .bashrc file ,

nano ~/.bashrc

and create the bash alias,

To do so add the following line into the .bashrc file:

alias python='/usr/bin/python3.6'

Save the file and re-open the terminal.

Edit:

Similarly, if you don't want to create the direct alias.

As @exprator suggested above you can also use python command for python 2 and python3 to use Python 3 version

ShivaGaire
  • 2,283
  • 1
  • 20
  • 31
1

Just use python in terminal for python 2.7 and type python3 to use python 3.6 when you need

Exprator
  • 26,992
  • 6
  • 47
  • 59
0
  1. . ~/.bashrc
  2. alias python='/usr/bin/python3.4'
Gowtham Balusamy
  • 728
  • 10
  • 22
0

By the way, you shouldn't use the default environment to develop. Instead, you have to use Virtualenv