Console. Python Console
for Windows and Linux
Use this page to define the Python interpreter, its options, starting script and so on for the Python console.
|Project||Click this list to select one of the projects, opened in the same PyCharm window, where this run/debug configuration should be used. If there is only one open project, this field is not displayed.|
This field shows the list of environment variables. If the list contains several variables, they are delimited with semicolons.
Variable1 = Value1 Variable2 = Value2Just copy the list of variables from the text file and click Paste () in the Environmental Variables dialog. 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, click Copy , and paste them into a text file.
|Python Interpreter||Select one of the pre-configured Python interpreters from the list.|
|Interpreter options||In this field, specify the string to be passed to the interpreter. If necessary, click Enter, and type the string in the editor.|
|Working directory||Specify a directory to be used by the running console. When this field is left blank, the project directory will be used.|
|Configure interpreters||If the desired interpreter is missing in the list, click this link to open the Python Interpreters page, and configure an interpreter or virtual environment, as described in the section Configuring Python SDK.|
|Add content roots to PYTHONPATH||Select this checkbox to have the content roots added to the PYTHONPATH.|
|Add source roots to PYTHONPATH||Select this checkbox to have the source roots added to the PYTHONPATH.|
In 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:
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.