Python In Visual Studio For Mac

Active1 year, 1 month ago

Usman works on Python and R Tools for Visual Studio and the Azure Python SDK. Previously, he was on the Developer Ecosystem and Platform team in Windows and Devices Group, where he worked on the Universal Windows Platform (UWP), UWP on Xbox, Windows 10 Bridge for Desktop Apps, and putting open source software in Windows. For Visual Studio to become the goto dev tool on Mac, adding Python support would go a long way to make that happen.

I cannot seem to get Python3 to work when debugging it continues to use Python2. I've tried a few things but still am unable to get it work. I verified Python3s path is /usr/local/bin/python3Everytime I run a script to by

I still get 2.7.10python 3 is installed and work correctly.

I have this in my launch.json and settings.json (type and request are both grayed out for some reason in the launch.json)

Suraj Rao
25.3k8 gold badges65 silver badges76 bronze badges
SeanJohnSeanJohn

4 Answers

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

This will update your .vscode/settings.json file:

You should then be able to debug using python 3 interpreter or any other python interpreter is available on your machine.

kimbaudikimbaudi
3,2785 gold badges28 silver badges42 bronze badges

This is not an answer, but my rep won't allow a comment:For me your proposed solution worked just fine. Here some troubleshooting:

  • Did you change the original launch.json entry? Then you probably need to reload it, which should happen automatically, but restarting VSCode will do that for sure.
  • Also, I would recommend using the 'Add Configuration' button, then choose 'python', and edit the name in the new entry (from 'Python' to 'Python3') as not to clash with the old python entry, as well as change the 'pythonPath' key's value from '${config:python.pythonPath}' to '/usr/local/bin/python3'

To use this config, select in the Debug dropdown box.

TascheTasche

Python Tools For Visual Studio For Mac

if you use 'code runner',you can try to open user settings with command palette.

Studio

it's work for me.

V-rund Puro-hit

Visual Studio For Mac Download

4,3768 gold badges21 silver badges47 bronze badges
謝騰緯謝騰緯

What worked for me is adding the following to User Settings:

kimbaudi
3,2785 gold badges28 silver badges42 bronze badges
Lech Migdal

Installing Python In Visual Studio Youtube

Lech Migdal

Python Visual Studio Machine Learning

1,9352 gold badges22 silver badges41 bronze badges

Not the answer you're looking for? Browse other questions tagged pythonjsonmacospython-3.xvisual-studio-code or ask your own question.