0

I'm trying to run Python in Sublime but I get a syntax error because it's running Python 2.7.

I tried to create a new build with

{
  "cmd": ["/usr/bin/python3", "-u", "$file"],
  "file_regex": "^ ]*File \"(...*?)\", line ([0-9]*)",
  "selector": "source.python"

but that isn't working either. I made a new Python file with

import sys
print("Sublime is using: ", sys.version)

and I get

('Sublime is using: ', '2.7.16 (default, Oct 16 2019, 00:35:27) \n[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]')

I ran whereis python3 in the terminal and nothing returned. When I did whereis python I got usr/bin/python. When I did which python 3, I got /usr/bin/python.

I have no idea what to do to fix this.

9
  • 1
    Did you mean to have a space in which python 3? For me, which ignores the 3 and just prints the path to python2. Commented Jan 26, 2020 at 5:34
  • yes, you're correct. the path is then /Library/Frameworks/Python.framework/Versions/3.8/bin/python3. however, my issue remains with sublime Commented Jan 26, 2020 at 5:38
  • Does /usr/bin/python3 exist? Commented Jan 26, 2020 at 5:39
  • that's the thing. when i type whereis python3 in terminal, nothing shows up and i'm not sure why or how to fix it Commented Jan 26, 2020 at 5:40
  • Wait, in comment #2 I thought you said running where python3 returns a path? Or does it return nothing? Commented Jan 26, 2020 at 5:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.