angrychimp
angrychimp

Reputation: 696

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?

Upvotes: 1

Views: 3680

Answers (2)

John Paul Barbagallo
John Paul Barbagallo

Reputation: 452

In VS Code, you're able to easily set the interpreter you'd like to use for Python. Follow this official guide.

From the site:

To select a specific interpreter, select the Python: Select Interpreter command from the Command Palette (⇧⌘P).

Upvotes: 3

angrychimp
angrychimp

Reputation: 696

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).

Upvotes: 4

Related Questions