Configure 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 Show All.
, click or expand the list of interpreters, and choose
Configure the list of interpreters
In Add.
, click and chooseChoose 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.
If New environment is selected:
Specify the location of the new virtual environment in the text field, or click and find location in your file system. The directory for the new virtual environment should be empty.
Choose the base interpreter from the list, or click and find a Python executable in the your file system.
If CLion detects no Python on your machine, it provides two options: to download the latest Python versions from python.org or to specify a path to the Python executable (in case of non-standard installation).
Select the Inherit global site-packages checkbox if you want that all packages installed in the global Python on your machine to be added to the virtual environment you're going to create. This checkbox corresponds to the
--system-site-packages
option of the virtualenv tool.Select the Make available to all projects checkbox if you want to reuse this environment when creating Python interpreters in CLion.
If Existing environment is selected:
Expand the Interpreter list and select any of the existing interpreters. Alternatively, click and specify a path to the Python executable in your file system, for example, C:\Python36\python.exe.
Select the Make available to all projects checkbox if you want to reuse this environment when creating Python interpreters in CLion.
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.
If New environment is selected:
Specify the location of the new Conda environment in the text field, or click and find location in your file system. Note that the directory where the new Conda environment should be located, must be empty!
Select the Python version from the list.
Specify the location of the Conda executable file in the text field, or click and find location in the Conda installation directory. You're basically looking for a path that you've used when installing Conda on your machine.
Select the Make available to all projects checkbox if you want to reuse this environment when creating Python interpreters in CLion.
If Existing environment is selected:
Expand the Interpreter list and select any of the existing interpreters. Alternatively, click and specify a path to the Conda executable in your file system, for example, C:\Users\jetbrains\Anaconda3\python.exe.
Select the Make available to all projects checkbox if you want to reuse this environment when creating Python interpreters in CLion.
Click OK to complete the task.
In the left-hand pane of the Add Python Interpreter dialog, select System Interpreter.
If CLion detects no Python on your machine, it provides two options: to download the latest Python versions from python.org or to specify a path to the Python executable (in case of non-standard installation).
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: 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.
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.