Install debugging symbols for Python interpreters in Visual Studio
This article provides steps to download and integrate debugging symbols for Python interpreters in Visual Studio.
To provide a full debugging experience, the mixed-mode Python debugger in Visual Studio needs debug symbols for the Python interpreter to parse numerous internal data structures. The debugging symbols are defined in program database (.pdb) files. For example, the python27.dll library requires the python27.pdb symbol file, the python36.dll library uses the symbol file python36.pdb, and so on. Each version of the interpreter also supplies symbol files for various modules.
In Visual Studio 2017 and later, the Python 3 and Anaconda 3 interpreters automatically install their respective symbols and Visual Studio finds the symbols automatically.
In Visual Studio 2015 and earlier, or for other interpreters, you need to download symbols separately and then point Visual Studio to the files.
When Visual Studio detects missing required symbols, a dialog prompts you to take action. You typically see the dialog when you start a mixed-mode debugging session. The dialog includes the Open symbol settings dialog link, which opens the Tools > Options dialog to the Debugging > Symbols tab, along with a link to this documentation article.
Prerequisites
- Visual Studio installed with support for Python workloads. For more information, see Install Python support in Visual Studio.
Check your interpreter version
Symbols differ between minor builds of Python and between 32-bit and 64-bit builds. It's important to confirm your version and build of Python to ensure you have the correct symbols for your interpreter.
To check which Python interpreter is in use:
In Solution Explorer, expand the Python Environments node under your project.
Locate the name of the current environment (shown in bold).
Right-click the environment name and select Open Command Prompt Here.
A command prompt window opens to the install location of the current environment.
Start python by entering the following command:
python.exe
The execution process displays your installed Python version and indicates whether it's 32-bit or 64-bit:
Download symbols
The following steps describe how to download the required symbols for a Python interpreter.
For Python 3.5 and later, acquire the debug symbols through the Python installer.
Select Custom installation, then select Next.
On the Advanced Options page, select the boxes for Download debugging symbols and Download debug binaries:
The symbol files (.pdb) are located in the root installation folder. Symbol files for individual modules are also placed in the DLLs folder.
Visual Studio finds these symbols automatically. No further steps are needed.
For Python 3.4.x and earlier, symbols are available as downloadable
.zip
files from the official distributions or from Enthought Canopy.Download your required symbol file.
Important
Be sure to select the symbol file that corresponds to your installed Python version and build (32-bit or 64-bit).
Extract the symbol files to a local folder within the Python folder, such as Symbols.
After you extract the files, the next step is to Point Visual Studio to the symbols.
For other third-party Python distributions such as ActiveState Python, contact the authors of that distribution and request them to provide you with symbols.
WinPython incorporates the standard Python interpreter without changes. You can use symbols from the official WinPython distribution for the corresponding version number.
Point Visual Studio to the symbols
If you downloaded symbols separately, follow these steps to make Visual Studio aware of the symbols.
Note
If you installed symbols by using the Python 3.5 or later installer, Visual Studio finds the symbols automatically. You don't need to complete the steps in this section.
Select Tools > Options, and open the Debugging > Symbols tab.
Select Add (plus symbol) on the toolbar.
Enter the folder path where you extracted the downloaded symbols. This location is where the
python.pdb
file is located, such as c:\python34\Symbols, as shown in the following image.Select OK.
During a debugging session, Visual Studio might also prompt you for the location of a source file for the Python interpreter. If you downloaded source files, such as from python.org/downloads/, you can point Visual Studio to the downloaded files.
Symbol caching options
The Tools > Options, Debugging > Symbols dialog also contains options to configure symbol caching. Visual Studio uses the symbol caching features to create a local cache of symbols obtained from an online source.
These features aren't needed with the Python interpreter symbols because symbols are already present locally. For more information, see Specify symbols and source files in the Visual Studio debugger.
Access downloads for official distributions
The following table lists download information for official Python version releases.
Python version | Downloads |
---|---|
3.5 and later | Install symbols through the Python installer. |
3.4.4 | 32-bit - 64-bit |
3.4.3 | 32-bit - 64-bit |
3.4.2 | 32-bit - 64-bit |
3.4.1 | 32-bit - 64-bit |
3.4.0 | 32-bit - 64-bit |
3.3.5 | 32-bit - 64-bit |
3.3.4 | 32-bit - 64-bit |
3.3.3 | 32-bit - 64-bit |
3.3.2 | 32-bit - 64-bit |
3.3.1 | 32-bit - 64-bit |
3.3.0 | 32-bit - 64-bit |
2.7.18 | 32-bit - 64-bit |
2.7.17 | 32-bit - 64-bit |
2.7.16 | 32-bit - 64-bit |
2.7.15 | 32-bit - 64-bit |
2.7.14 | 32-bit - 64-bit |
2.7.13 | 32-bit - 64-bit |
2.7.12 | 32-bit - 64-bit |
2.7.11 | 32-bit - 64-bit |
2.7.10 | 32-bit - 64-bit |
2.7.9 | 32-bit - 64-bit |
2.7.8 | 32-bit - 64-bit |
2.7.7 | 32-bit - 64-bit |
2.7.6 | 32-bit - 64-bit |
2.7.5 | 32-bit - 64-bit |
2.7.4 | 32-bit - 64-bit |
2.7.3 | 32-bit - 64-bit |
2.7.2 | 32-bit - 64-bit |
2.7.1 | 32-bit - 64-bit |
Use Enthought Canopy symbols
Enthought Canopy provides debugging symbols for its binaries starting from version 1.2. These symbols are automatically installed alongside with the distribution.
To use the symbols, manually add the folder that contains the symbols to the symbol path, as described in Point Visual Studio to the symbols.
For a typical per-user installation of Canopy, the symbols are located in the following folders:
- 64-bit version: %UserProfile%\AppData\Local\Enthought\Canopy\User\Scripts
- 32-bit version: %UserProfile%\AppData\Local\Enthought\Canopy32\User\Scripts
Enthought Canopy 1.1 and earlier and Enthought Python Distribution (EPD), don't provide interpreter symbols. These releases aren't compatible with mixed-mode debugging.