CLion 2019.2 Help

Configuring Python Interpreters

The list of Python SDKs, available for the various projects, can include interpreters installed locally, as well as the virtual environments. The procedure described below supposes that the necessary Python interpreters are already installed on your computer.

View the list of the available interpreters

  • In Settings/Preferences | Build, Execution, Deployment | Python Interpreter, click icons general gearPlain svg or expand the list of interpreters, and choose Show All.

Configure the list of interpreters

  1. In Settings/Preferences | Build, Execution, Deployment | Python Interpreter, click icons general gearPlain svg and choose Add.

  2. Choose the interpreter type to add and perform the specific settings:

    In the left-hand pane of the Add Python Interpreter dialog, select Virtualenv Environment. The following actions depend on whether the virtual environment existed before.

    creating a virtual environment

    If New environment is selected:

    1. Specify the location of the new virtual environment in the text field, or click Virtual environment location and find location in your file system. The directory for the new virtual environment should be empty.

    2. Choose the base interpreter from the list, or click Choose the base interpreter and find a Python executable in the your file system.

    3. Select the Inherit global site-packages checkbox if you want to inherit your global site-packages directory. This checkbox corresponds to the --system-site-packages option of the virtualenv tool.

    4. Select the Make available to all projects checkbox, if needed.

    If Existing environment is selected:

    1. Expand the Interpreter list and select any of the existing interpreters. Alternatively, click Select an interpreter and specify a path to the Python executable in your file system, for example, C:\Python36\python.exe.

    2. Select the checkbox Make available to all projects, if needed.

    Click OK to complete the task.

    In the left-hand pane of the Add Python Interpreter dialog, select Conda Environment. The following actions depend on whether the Conda environment existed before.

    creating Conda environment

    If New environment is selected:

    1. Specify the location of the new Conda environment in the text field, or click Conda environment location and find location in your file system. Note that the directory where the new Conda environment should be located, must be empty!

    2. Select the Python version from the list.

    3. Specify the location of the Conda executable file in the text field, or click Conda executable location and find location in the Conda installation directory.

    4. Select the Make available to all projects checkbox, if needed.

    If Existing environment is selected:

    1. Expand the Interpreter list and select any of the existing interpreters. Alternatively, click Select an interpreter and specify a path to the Conda executable in your file system, for example, C:\Users\jetbrains\Anaconda3\python.exe.

    2. Select the checkbox Make available to all projects, if needed.

    Click OK to complete the task.

    In the left-hand pane of the Add Python Interpreter dialog, select System Interpreter.

    Adding a system interpreter

    You will need admin privileges to install, remove, and upgrade packages for the system interpreter. When attempting to install an interpreter package through an intention action, you might receive the following error message:

    System Interpreter warning message
    As prompted, consider using a virtual environment for your project.

    Click OK to complete the task.
    In the left-handed pane of the Add Python Interpreter dialog, select Pipenv.
    creating Pipenv environment

    If you have added the user base’s binary directory to your PATH environmental variable, you don't need to set any additional options: the path to the pipenv executable will be autodetected.

    If you have not modified the PATH variable, CLion shows an error message: Pipenv executable is not found. Enter the executable path in the Pipenv executable field, for example: C:\Users\jetbrains\AppData\Roaming\Python\Python37\Scripts\pipenv.exe (Windows) or /Users/jetbrains/.local/bin/pipenv (macOS).

    Click OK to save the changes and complete the task.

Last modified: 22 August 2019