Search code examples
python-3.xpython-2.7debuggingvisual-studio-codepylint

How can I get pylint to use python 3 in VS code?


I want pylint to use python3 for linting in Visual Studio code on Mac (which has both python 2.7 standard and python 3.6).

I've tried changing the path to the python interpreter as per How can I debug Python3 code in Visual Studio Code, to no avail. I keep getting python2 errors instead of python3 errors.

See example code for the problem.

Is there a way I can get pylint to recognize python3 errors?


Solution

    1. Pick a xx.py in Visual Studio Coce(VSC)
    2. In Status Bar Tap Python 2.7.10 like the [img1]
    3. Choose python 3.x like [img2]
    4. Command+Q quit VSC, then open VSC again

    enter image description here

    img2