Preparations
In Windows, remote Python code redirection and association are supported.
Configuring the Python SDK
To meet Python code debugging requirements during application development, a Python code debugging method based on the Python Community Edition plugin is provided. The debugging preparation is as follows. Configuration of the global Python SDK is used as an example. For details, see Python SDK Settings.
- On the top menu bar, choose .
- On the left of Project Structure, choose . Then, click + and select Add Python SDK in the displayed dialog box, as shown in Figure 1.
- In the Add Python Interpreter dialog box, select a proper Python interpreter and add it. Table 1 shows the available interpreters. Click OK.Figure 2 Adding a Python interpreter
Table 1 Python interpreter options Interpreter
Description
Virtualenv Environment
Integrates the Virtual Environment tool to create an independent virtual environment.
Conda Environment
Uses the Python interpreter contained in Anaconda.
System Interpreter
Specifies the local interpreter in the system.
Pipenv Environment
Pipenv is a tool that provides all the necessary methods to create a virtual environment for Python projects.
Poetry Environment
Uses the Poetry tool to create a virtual environment based on project dependencies.
SSH Interpreter
Specifies a remote interpreter. You can add the Python SDK of a remote device in SSH mode and use the Deployment function to synchronize the files and folders in a specified project to a specified directory on the remote device. For details, see Ascend Deployment. (If you select this option, MindStudio remotely runs a project.)
Debugging and Building the Configuration File
- On the top menu bar, choose or click Figure 3 on the toolbar to access the run configuration page.
- Click + in the upper left corner, select , and add the run and debug configurations of the file.
- The configuration options are displayed on the right. Table 2 describes the key configuration parameters. Figure 4 shows a configuration example.Click Apply, and then click OK to save the settings and close the debug configuration page.
Table 2 Key debug and run parameters Parameter
Description
Name
This parameter is user-defined.
Script path
Select the path of the Python source file to be debugged.
Python interpreter
Use SDK of module: Use a module-level Python SDK to parse data.
For details, see Setting the Module-Level Python SDK (Ascend Project) or Setting the Module-Level Python SDK (Non-Ascend Project).
Use specified interpreter: Use a specified interpreter that has been configured.
For details, see Python SDK Settings.
Working directory
Working directory (defaults to the directory where the Python source file to be debugged is located).


