IntelliJ IDEA 2018.2 Help

Python Console

File | Settings | Build, Execution, Deployment | Console | Python Console for Windows and Linux
IntelliJ IDEA | Preferences | Build, Execution, Deployment | Console | Python Console for macOS
Ctrl+Alt+S

settings

Use this page to define the Python interpreter, its options, starting script etc. for the Python console.

ItemDescription
Environment
ProjectClick this drop-down list to select one of the projects, opened in the same IntelliJ IDEA window, where this run/debug configuration should be used. If there is only one open project, this field is not displayed.
Environment variablesThis field shows the list of environment variables. If the list contains several variables, they are delimited with semicolons.
To fill in the list, click the browse button, or press Shift+Enter and specify the desired set of environment variables in the Environment Variables dialog box.
To create a new variable, click icons general add, and type the desired name and value. You might want to populate the list with the variables stored as a series of records in a text file, for example:
Variable1 = Value1 Variable2 = Value2
Just copy the list of variables from the text file and click Paste (Paste) in the Environmental Variables dialog box. The variables will be added to the table. Click Ok to complete the task. At any time, you can select all variables in the Environment Variables dialog box, click Copy (Copy), and paste them into a text file.
Python Interpreter From the drop-down list, select one of the pre-configured Python interpreters.
Interpreter optionsIn this field, specify the string to be passed to the interpreter. If necessary, click shift enter button, and type the string in the editor.
Working directorySpecify a directory to be used by the running console. When this field is left blank, the project directory will be used.
Configure interpretersIf the desired interpreter is missing in the drop-down list, click this link to open the Python interpreters page, and configure an interpreter or virtual environment.
Add content roots to PYTHONPATHSelect this checkbox to have the content roots added to the PYTHONPATH.
Add source roots to PYTHONPATHSelect this checkbox to have the source roots added to the PYTHONPATH.
Starting scriptIn this editor area, type the script to be executed in the console after its start-up and initialization. Note that syntax highlighting, code completion, import assistance, documentation, inspections and quick fixes are available in this editor:
py startingScript

By default, this area contains the following script, which causes printing out a header information and extending the system paths:

import sys; print('Python %s on %s' % (sys.version, sys.platform)) sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])

If you want to omit such a printout, delete this script.

Last modified: 14 June 2018

See Also

Language and Framework-Specific Guidelines: