Visual Studio Code (Windows) – Setting up a Python Development Environment and Complete Overview

///Visual Studio Code (Windows) – Setting up a Python Development Environment and Complete Overview

Visual Studio Code (Windows) – Setting up a Python Development Environment and Complete Overview

FavoriteLoadingAdd to favorites

In this Python Programming Tutorial, we will be learning how to set up a Python development environment in VSCode on Windows. VSCode is a very nice free editor for writing Python applications and many developers are now switching over to this editor. In this video, we will learn how to install VSCode, get the Python extension installed, how to change Python interpreters, create virtual environments, format/lint our code, how to use Git within VSCode, how to debug our programs, how unit testing works, and more. We have a lot to cover, so let’s go ahead and get started…

VSCode on MacOS –

Timestamps for topics in this tutorial:
Installation – 1:13
Python Extension – 5:48
Switching Interpreters – 10:04
Changing Color Themes – 12:35
VSCode Settings – 16:16
Set Default Python – 21:33
Using Virtual Environments – 25:10
IntelliSense – 29:45
Code Formatting – 32:13
Code Linting – 37:06
Code Runner Extension – 39:42
Git Integration – 47:44
Use Different Terminal – 51:07
Debugging – 58:45
Unit Testing – 1:03:25
Zen Mode – 1:09:55

VSCode Site –
Python Installation –
Source Code Pro –
VENV Tutorial –
Git Tutorial –
Unit Testing Tutorial –
My VSCode Settings –

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet – 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet – 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet – MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey’s Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:
My Website –
My Second Channel –
Facebook –
Twitter –
Instagram –

#Python #VSCode

source

By |2019-12-13T00:32:15+00:00December 13th, 2019|Python Video Tutorials|50 Comments

50 Comments

  1. Corey Schafer December 13, 2019 at 12:32 am - Reply

    Hey everybody. So this tutorial is a long one, but we cover just about anything you'd want to know about Python development within VSCode. Timestamps for topics in this tutorial:
    Installation – 1:13
    Python Extension – 5:48
    Switching Interpreters – 10:04
    Changing Color Themes – 12:35
    VSCode Settings – 16:16
    Set Default Python – 21:33
    Using Virtual Environments – 25:10
    IntelliSense – 29:45
    Code Formatting – 32:13
    Code Linting – 37:06
    Code Runner Extension – 39:42
    Git Integration – 47:44
    Use Different Terminal – 51:07
    Debugging – 58:45
    Unit Testing – 1:03:25
    Zen Mode – 1:09:55

    If I missed anything then just let me know. Hope you're all having a great week!

  2. Av8oR_127 December 13, 2019 at 12:32 am - Reply

    Why is it that when I run something, I get a bunch of output instead of just the print(). For instance, it starts with cd 'c:users…projects'; ${env:ALLUSERSPROFILE}= 'C:ProgramData'; and about 16 more lines? Then gives the print()

  3. Doylan Mihov December 13, 2019 at 12:32 am - Reply

    Hey I can not find this on google anywhere, but how can I use an external text file and then use numpy to read it or .loadtxt etc. I have numpy installed into my virtual enviroment but it cant seem to find my txt file and use it in my script.

  4. Olivier Daigle December 13, 2019 at 12:32 am - Reply

    Hey Corey, thanks for putting this tutorial together. It was very useful.

  5. Nihi Lanz December 13, 2019 at 12:32 am - Reply

    Very helpful. Thanks friend.

  6. Frederick Corpuz December 13, 2019 at 12:32 am - Reply

    Just set up my VS code today! @Corey Schafer any chance you have an intro to Python package development video in the works?

    I'm trying to figure out a good workflow for developing my modules+ unittests + sample scripts in VS code. I've watched a lot of your tutorials already on those topics separately. But, a video tutorial from you that ties everything together would be amazing.

  7. Dear Julio December 13, 2019 at 12:32 am - Reply

    Great content Corey! Thanks

  8. Abel Johnson Inaibo December 13, 2019 at 12:32 am - Reply

    just wondering how you got so infused in python! i can not thank you enough

  9. Gurumoorthy Ganesan December 13, 2019 at 12:32 am - Reply

    For the half of the tutorial, I was like.. GOD INSTALL THAT PYLINT ALREADYYY!!! GRRRR….. Thanks for the Wonderful Tutorial.. 😛 😀

  10. Pedro Puglia December 13, 2019 at 12:32 am - Reply

    If I want t check wheter I have a certain module/extension installed in my virtual environment, it should be under venv->Lib right?

  11. D T December 13, 2019 at 12:32 am - Reply

    Thank you for this walk through. I'm an R user that wants to start learning Python. I was looking for an IDE that's comparable to phenomal R Studio and it looks like VS Code comes pretty close to it. Curios to see all the content your channel has to offer for new Python users.

  12. Yashwanth Ravula December 13, 2019 at 12:32 am - Reply

    I got the 'run button' by default even before installing 'Run code' extension.
    I think this comes with the latest version of VScode.

  13. Yashwanth Ravula December 13, 2019 at 12:32 am - Reply

    You may encounter this error: "ps1 cannot be loaded because running scripts is disabled on this system"

    This could be due to the current user having an undefined ExecutionPolicy.

    Solution:
    You could try the following:
    Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

  14. starterclick December 13, 2019 at 12:32 am - Reply

    'python' is not recognized as an internal or external command, operable program or batch file. Having issues with code runner here !!!

  15. Shakeel Ahmad December 13, 2019 at 12:32 am - Reply

    Thanks Corey Schafer for the most comprehensive explanation for setting up VS Code on windows. Never saw such an easy-to-understand video on Youtube. Indeed you are the best teacher for aspiring web developers around the globe. God bless you.

  16. Igor Garabajiv December 13, 2019 at 12:32 am - Reply

    Great tutorial. Please post more on VS code and advanced python

  17. Wolf Rage December 13, 2019 at 12:32 am - Reply

    The best vs code setup by far, thanks a ton

  18. Wolf Rage December 13, 2019 at 12:32 am - Reply

    I have one problem…. while doing "code-runner.executorMap":{

    "python": "$pythonPath -u $fullFileName",

    },
    It ain't running the code because the folder name I'm working contains spaces, so, for instance, my folder name is "VS Code Tutorial"
    then it's showing c:UsersbrainDesktopVS' is not recognized as an internal or external command,

    operable program or batch file.

    Any help would be appreciated. Thanks

  19. felix ezequiel Andre December 13, 2019 at 12:32 am - Reply

    In the debugging part of this video.
    How can I set up my debug to take arguments when I run my code i.e:
    python tests.py ./file1.txt ./file2.txt

    ??

  20. Dank -ster December 13, 2019 at 12:32 am - Reply

    Worst tutorial i can ever imagine.

  21. Mike Freeman December 13, 2019 at 12:32 am - Reply

    Regarding the Code Runner Extension, if you have spaces in your python executable path like Program Files (x86) for example, the documentation recommands to surrond the file path with " . So use:

    "code-runner.executorMap": {

    "python": ""$pythonPath" -u $fullFileName"
    },

  22. Matthew Weston December 13, 2019 at 12:32 am - Reply

    Atom had potential but I ran into some bumbs at first and then went back months later anbd hit another bumb within 20 minutes, I have the visual studio installer on 2 of my PC's (desk top and a laptop may put it on Macbook now) how ever only installed it once and never used it, one day noticed how large it was and that partition was runninng low on my SSD abd was like oh shit uninstalled, but removed some distros of that machine, more space, think i'm gonna go install it. PyCharm is alright, and was just getting use to it, however it just seems like they over complacate too many things, or add things that aren't neccasary, or add them in a way that is confusing, and cluttered and neads to much research, it's just not organized, or formatted well. I realize it has tons of features and controlability of you files and projectss and terminals ect. I dont need hald that, probably 90% of the things on there I will never touch, a damn Vim emulator! I have Vim but haven't gottten around to learning very much of it yet, would love to, haven't found thhe time, but for fuck sake, a VIM EMULATOR thats when you know you gone to far, also these things are not added seperatley, not packages or add-on of any kind, it's standard and on every download, it's to robust, it's about to explode from garbage filling it to the brim, just so they can have the most robust IDE, and thats not a good thing, not in there format.

  23. Eisenhower303 December 13, 2019 at 12:32 am - Reply

    You can just add a keyboard shortcut to run python. Click the gear icon in the lower left, go to keyboard shortcuts, and search for “run Python in terminal” . And it will work with input, unlike Code Runner

  24. N I December 13, 2019 at 12:32 am - Reply

    thumbs up for LOL

  25. Keonard December 13, 2019 at 12:32 am - Reply

    min 30:50 -why when i click in go to definition, he say: "no definicion set for 'get' "?.

    my code here:
    import sys
    import pip._vendor.requests

    print(sys.version)
    print(sys.executable)

    def greet(msg):
    greeting = 'Hellos, {}'.format(msg)
    return greeting

    print(greet('world'))

    r = requests.get

  26. Charly vq December 13, 2019 at 12:32 am - Reply

    League of Legends xD

  27. Lewis Cunningham December 13, 2019 at 12:32 am - Reply

    This is a great video. I learned things I didn't even know I needed to learn.

  28. Iain McKenzie December 13, 2019 at 12:32 am - Reply

    Hi there, great video but im having a problem with executing the get requests in that im receiving an ssl error (unable to get local issuer certificates). Does anybody know a work around for this?

  29. Games TV December 13, 2019 at 12:32 am - Reply

    This tutorial uncovered a lot of powerful features which I never knew of.
    Nice tutorial Corey.

  30. Le Charo du 35 December 13, 2019 at 12:32 am - Reply

    28:40 when I try to open a new terminal with my venv it execute he same command as you like it should but i get an error so I can't use my venv in the vscode terminal if someone got the awnser I'd love to know it.

  31. John Ho December 13, 2019 at 12:32 am - Reply

    Thanks for this video. Very helpful especially as someone fairly new to coding.

  32. Number Juan December 13, 2019 at 12:32 am - Reply

    @Corey Schafer this is fantastic, Thank you!!! I'm relatively new to Python ~1 year. I can't believe I hadn't heard of this IDE. I'm trying to run some scripts continually wasn't able to do it with my Jupyter Notebooks very easily.

  33. Stephen December 13, 2019 at 12:32 am - Reply

    I dont have the json things

  34. Krushna Ekbote December 13, 2019 at 12:32 am - Reply

    This is the most useful information for setting up python on VS Code! Thanks a lot buddy!!!

  35. Shahriar Rahman December 13, 2019 at 12:32 am - Reply

    Problems you might face:
    1. While running "python -m venv ANY_VENV_NAME" you may face a problem where it says: "No such file or directory: 'C:python37libvenvscriptsntbla bla'"
    Solution: Run anaconda prompt in admin mode and run "conda update python"
    Retry the whole process now. It worked for me

    2. After solving prob 1, while trying to activate your venv this error may occur: "bla bla Cannot be loaded because running scripts is disabled on this system bla bla"
    Solution: add this line in settings.json file: "terminal.integrated.shellArgs.windows": ["-ExecutionPolicy", "Bypass"]
    Now try again 🙂

  36. Angela Norris December 13, 2019 at 12:32 am - Reply

    Clear and to the point. Thanks

  37. BlackMageZeraf December 13, 2019 at 12:32 am - Reply

    so you are also a League Player :V I hope you don't play Cancer like Yasuo :V

  38. Haider Ghufran December 13, 2019 at 12:32 am - Reply

    27:00 if it does not run than follow that
    -> go to start -> powershell (administrator) -> python -m pip install –upgrade pip -> enter
    and then come back to your vscode and try again.
    thanks me later

  39. John Guy December 13, 2019 at 12:32 am - Reply

    Just started using VS Code with Python. This is an excellent video.

  40. Lance Tschirhart December 13, 2019 at 12:32 am - Reply

    1900 : 18 like ratio, sweet.

  41. SAM SOUFI December 13, 2019 at 12:32 am - Reply

    Dude! you won yourself a new subscriber today, hope YouTube gives you loads of money cause of it.

  42. SonixRush December 13, 2019 at 12:32 am - Reply

    great video your a great teacher. RESPECT

  43. Chima Divine December 13, 2019 at 12:32 am - Reply

    Thank you. U know, one thing is knowing how to code and another thing is to know how to set-up the environment. I'm currently having problems using Atom & sublime editors for python. VS is actually great! Thanks again

  44. mapabu December 13, 2019 at 12:32 am - Reply

    Is this 1.25x?

  45. Surendra Sawant December 13, 2019 at 12:32 am - Reply

    Great tutorial for setting python environment in vscode I already using vscode

  46. E Anderson December 13, 2019 at 12:32 am - Reply

    Perfect, provides a very wide and practical guide to coding in python with VSCode. Thanks!

  47. vinod kc December 13, 2019 at 12:32 am - Reply

    Windows have a nice friend named ".exe" So at the end what if we want to convert our code as an exe file ? Did you miss this point ?

  48. Pedro Carneiro Jr. December 13, 2019 at 12:32 am - Reply

    Hey Corey. Amazing tutorial! Anyhow, I'm a bit lost at the Git integration part. What Git extension is that? GitLens? Which one would be best in order to follow this specific tutorial?

  49. MrDamn December 13, 2019 at 12:32 am - Reply

    Why is my terminal opening in a separate window? I can't type anything into the integrated terminal…. Great video btw 🙂

  50. SeLMeZz December 13, 2019 at 12:32 am - Reply

    for anyone facing unreadable letters in output section, if they run an output contains RTL languages_, for e.g. _Arabic

    "code-runner.executorMap": {

    "python": "set PYTHONIOENCODING=utf8 && $pythonPath -u $fullFileName"

    }

Leave A Comment

*