Wednesday, October 20, 2021

How to set Python3 as default interpreter for VS Code | or set any version as default interpreter.

Want to run your python code with a particular python version? And, make it the default version?

Read on..

Make sure that the required version is installed. You check the available version and the path by running this command.

krishnasanjeevaiah@krishnasanjeevaiah-mac ~ % which python  

/usr/bin/python


krishnasanjeevaiah@krishnasanjeevaiah-mac ~ % which python2

/usr/bin/python2


krishnasanjeevaiah@krishnasanjeevaiah-mac ~ % which python3 

/Library/Frameworks/Python.framework/Versions/3.7/bin/python3


Now you know the path and versions available.
In the VS code, go to the View menu and select Command Pallete



Now search for Python and you will get all the installer versions of python.



Then select Python: Select interpreter. You will get all the installed versions of python. Select the one you want to be associated with your script.





No comments:

Post a Comment

How to set Python3 as default interpreter for VS Code | or set any version as default interpreter.

Want to run your python code with a particular python version? And, make it the default version? Read on.. Make sure that the required versi...