Learn how to run scripts from VS Code and PyCharm.
Running Python Code From an IDE or Text Editor
00:00 Next, running code from an IDE or text editor. Visual Studio Code—Windows. In Windows Explorer, you can navigate to your file, and if you’ve got VS Code installed, right-clicking and then Open with will allow you to open it in VS Code.
00:30 Visual Studio Code on Mac. In Finder, you can navigate to your Python script, and once you get there, you can double-tap or right-click to open up the context menu and go to Open With and then pick Visual Studio Code.
00:50 Then you can go to Terminal and Run Active File, and you can see there’s a problem. An error has been generated with unexpected tokens, and this is because VS Code in this case needs to be told how to interpret the script. That’s done with the line being typed onscreen now, which you may remember from the Ubuntu example earlier in the series.
01:32 Once you’ve found the file, you can right-click or double-tap and go to Open With > PyCharm. And once PyCharm launches and opens up your file, it’s as easy as double-tapping or right-clicking, and then picking Run.
Become a Member to join the conversation.