pythonmacosvscode-code-runner

Why is Code Runner using the old 2.7.1 version of Python instead of 3.x on OSX?


I am trying to use the newer version of Python but when I type:

import sys
print sys.version_info

I get back:

sys.version_info(major=2, minor=7, micro=1, releaselevel='final', serial=0)

In the terminal when I enter python I get:

Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin

When I enter python3 I get:

Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 13:52:24) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

As you see, I have installed Python 3.3 but no matter what I do I can't seem to actually use it in Code Runner.


Solution

  • CodeRunner->Preferences->Languages->Run Command

    edit "python $filename" to "python3 $filename"