Python SDK Settings

Setting the Global Python SDK

  1. On the project page, choose File > Project Structure. The Project Structure... dialog box is displayed.
  2. In the navigation bar on the left, choose Platform Settings > SDKs. In the configuration window on the right, click + and choose Add Python SDK... to access the window for adding a Python interpreter.
    Figure 1 Adding the global Python library

  3. In the Add Python Interpreter window, select a proper Python interpreter based on the actual requirements. Table 1 lists the optional 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.

  4. Import other third-party Python libraries or custom Python libraries based on your actual requirements. Click OK to close the Project Structure window.
    Figure 3 Viewing the Python libraries

Setting the Project-Level Python SDK

  1. On the project page, choose File > Project Structure. The Project Structure dialog box is displayed.
  2. In the navigation bar on the left, choose Project Settings > Project. The Project settings page is displayed.
    In the SDK area, select a configured Python SDK from the drop-down list or select Add Python SDK... to access the Python interpreter adding window. Then add a Python SDK and click Apply, as shown in Figure 4.
    Figure 4 Selecting Project SDK

Setting the Module-Level Python SDK (Ascend Project)

  1. On the project page, choose File > Project Structure. The Project Structure dialog box is displayed.
  2. In the navigation bar on the left, choose Project Settings > Modules. The Modules setting page is displayed.
    On the right of the new Python item, select a configured Python SDK from the drop-down list or click to customize a Python SDK, and click Apply, as shown in Figure 5.
    Figure 5 Adding the Python SDK

    Figure 6 Selecting an existing Python SDK or customizing a Python SDK

Setting the Module-Level Python SDK (Non-Ascend Project)

  1. On the project page, choose File > Project Structure. The Project Structure dialog box is displayed.
  2. In the navigation tree on the left, choose Project Settings > Modules. The Modules setting page is displayed.
    On the Dependencies tab page, select a configured Python SDK from the drop-down list or select Add Python SDK... to access the Python interpreter adding window. Then add a Python SDK and click Apply, as shown in Figure 7.
    Figure 7 Selecting Modules SDK