How do I use python 3 on terminal Mac

15,552

Solution 1

Just type python3 where you would have typed python.

For example open repl type python3 run app.py program with python3.6 type python3 app.py

Solution 2

type python3 on command window/ terminal window & press enter for exit from python type quit() & press enter

Share:
15,552
tomak
Author by

tomak

Updated on June 04, 2022

Comments

  • tomak
    tomak almost 2 years

    When I run python someCode.py in my terminal, I am actually using python 2.7

    I have installed python 3.6 on my Mac and would like to use it in terminal. how can I do that?

    • v.coder
      v.coder over 6 years
      Use python3 while initiating command line.
    • cs95
      cs95 over 6 years
      You should be able to just use python3.6 script.py.
    • Mark Setchell
      Mark Setchell over 6 years
      If you installed it with homebrew, either use /usr/local/bin/python3 or change your PATH with export PATH=/usr/local/bin:$PATH and then you can just use python3. Be sure to use /usr/local/bin/pip3 to install packages for that Python.