Visual Studio/Python

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Since Visual Studio 2010, VS has support for debugging and running Python applications.

Notes[edit | edit source]

Python is an interpreter, not a compiler. This means that, barring syntax errors, the code is executed at runtime. Hence Visual Studio (and others) have weak IntelliSense support.

Installation[edit | edit source]

Follow the instructions here. In particular, while you can use Visual Studio 2017's installer to install Python, this isn't needed and Python can be installed otherwise. The same applies if you want to use alternative Python distributions like Anaconda-Python.

Usage[edit | edit source]

Once you've installed it, a new project can be created by Python -> Python Application or from the option "From Existing Python Code". Running the Python code will open a command window where the code is run, and one can set breakpoints like any other program.