Search code examples
pythonmacosvisual-studio-codepython-3.6macos-high-sierra

VS Code not detecting Python3 interpreter on MacOS


I just upgrade python3 to 3.6 (using homebrew) and now VS Code doesn't seem to be aware of it. When I try to select my Python interpreter I see 2.7.9 and 2.7.10 (in /usr/bin and /usr/local/bin respectively) but I do not see 3.6.3 (/usr/local/bin/python3).

It's certainly in my path, and I'm aware that I can update settings.json manually, but I use both Python 2 and 3 for various projects and making them available via the interpreter switcher would be incredibly useful. Any ideas why Code isn't autodetecting python3? Or is there a way for me to force-add it to the list?


Solution

  • Figured it out. Something I clearly installed had modified by .bash_profile to include the following:

    # Setting PATH for Python 2.7
    # The orginal version is saved in .bash_profile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
    export PATH
    

    I commented that out, restarted Code, and now I can see all my Python interpreters listed (including 3.6.3).