Click here to Skip to main content
15,887,596 members
Articles / Programming Languages / Python
Tip/Trick

How to Use Python3 in Visual Studio Code

Rate me:
Please Sign up or sign in to vote.
4.56/5 (2 votes)
17 Apr 2016CPOL 54.5K   2  
How to configure Visual Studio code to work with Python3

Introduction

I love Visual Studio Code, really – it’s the longest lasting fav thing I’ve had, like, for evah! … I used to hack on Sublime, but I deleted it last week (for evah) in favor of vs code … it's the business.

Anyway, my love for it aside – I was starting some R&D the other day using it, and couldn’t get the darn thing to play nice with the latest version of Python. Using V2, no hassle, but V3 … nope … and dig as I might, I couldn’t find what settings to change. I reached out to @code who sent me to the wiki that kinda helped, but not quite…

Configure VS Code for Python3

After a lot of poking around and going down rabbit holes, I found the solution, you need to tweak the tasks.json file to tell it to use Python V3.

To get to that file, in vscode (mac) cmd+shift+P – type ‘task’ – select ‘configure task runner’, and edit the file to point the “command” at “python3”, and the (command line) args to point at ${file}. Save, Debug/Run .. works! … now, back to coding. :)

Image 1

Image 2

History

  • V1 - 17th April, 2016

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer SocialVoice.AI
Ireland Ireland
Allen is CTO of SocialVoice (https://www.socialvoice.ai), where his company analyses video data at scale and gives Global Brands Knowledge, Insights and Actions never seen before! Allen is a chartered engineer, a Fellow of the British Computing Society, a Microsoft mvp and Regional Director, and C-Sharp Corner Community Adviser and MVP. His core technology interests are BigData, IoT and Machine Learning.

When not chained to his desk he can be found fixing broken things, playing music very badly or trying to shape things out of wood. He currently completing a PhD in AI and is also a ball throwing slave for his dogs.

Comments and Discussions

 
-- There are no messages in this forum --