Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Code Runner using the old 2.71 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 CodeRunner.

like image 249
DGDD Avatar asked Nov 05 '13 19:11

DGDD


People also ask

How do I change Vscode in Python 3?

On your VS code press Ctrl + Shift + P, to open the command palette. Type and select “Python: Select Linter”. Choose PyLint from the list.

How do I use a different version of Python in Vscode?

To do so, open the Command Palette (Ctrl+Shift+P) and enter Preferences: Open User Settings. Then set python.defaultInterpreterPath , which is in the Python extension section of User Settings, with the appropriate interpreter.


2 Answers

For the latest version of VS Code, you need to open settings (shift+command+p) and override the python interpreter value.

vscode settings

like image 136
Ardhi Avatar answered Sep 17 '22 08:09

Ardhi


CodeRunner->Preferences->Languages->Run Command

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

like image 33
mzds Avatar answered Sep 19 '22 08:09

mzds