How To Install Python For Visual Studio Mac

Active1 year, 2 months ago

How to install visual studio code on mac. VSCode is the right now one of the best code editors from Microsoft. VS Code provides us great support for languages like Javascript, TypeScript, Python, PHP and many more languages. It has the vast number of extensions that.

I'm using an iMac with High Sierra. I used Anaconda to install both python 2.7.15 and python 3.6.5. I created virtual environments for both of these. I'm trying to learn python and I'm using Visual Studio Code. I've run scripts fine that were developed for python 3 but the code I'm currently working with was developed for python 2. I can not get VScode to run using a python 2 interpreter, it seems to use python 3 no matter what I do. I could rewrite the script to make it compatible with python 3 but I'd rather not do that. I've tried running VScode from the python 2 virtual environment but that seems to have no effect. I edited the settings in VScode and changed the variable python.pythonPath to point to python 2 but that doesn't work. I used the command pallet to change the python interpreter but that doesn't work either. How do I force VScode to run python 2.

jmh
jmhjmhHow To Install Python For Visual Studio Mac
5,4342 gold badges7 silver badges33 bronze badges

How To Install Python For Windows

How to install python for eclipse oxygenPython

1 Answer

Start VScode and open your python script. Using either the command palette or the status bar, select the python interpreter you wish to use. Both options present a list of available interpreters. Now you may run your code by right-clicking in the edit window and selecting 'Run python file in terminal'. A terminal window opens below the edit window and your code executes there. Note: You must execute your code using the right-click technique described above. Other methods, such as using the command palette with 'run: code', will not work

jmhjmh
5,4342 gold badges7 silver badges33 bronze badges

Adding Python To Visual Studio

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged macospythonvisual-studio-code .