Python console
Python console enables executing Python commands and scripts line by line, similar to your experience with Python Shell.
Working with Python console
The console appears as a tool window every time you choose the corresponding command on the Tools menu. You can assign a shortcut to open Python console: press Ctrl+Alt+S , navigate to Keymap , specify a shortcut for Main menu | Tools | Python or Debug Console .
The main reason for using the Python console within PyCharm is to benefit from the main IDE features, such as code completion, code analysis, and quick fixes.
You can use up and down arrow keys to browse through the history of executed commands, and repeat the desired ones. To preview the variable values calculated in the course of the execution, click and check the Special Variables list.

The console is available for all types of Python interpreters and virtual environments, both local and remote.
Preview a variable as an array
When your variables are numpy arrays or dataframes, you can preview them as an array in a separate window. To try it, do one of the following:
Click the link View as Array / View as DataFrame :
From the context menu of a variable, choose View as Array / View as DataFrame :
The variable will be opened in the Data tab of the SciView window.

Run source code from the editor in console
Open file in the editor, and select a fragment of code to be executed.
From the context menu of the selection, choose Execute Selection in Python Console , or press Alt+Shift+E :

With no selection, the command changes to Execute line in console . Choose this command from the context menu, or press Alt+Shift+E . The line at caret loads into the Python console, and runs.

Watch the code selection execution:
By default, the Python console executes Python commands using the Python interpreter defined for the project. However, you can assign an alternative Python interpreter.
Run asyncio coroutines
In the editor, select a fragment of code which contains the definition of an asyncio coroutine.
From the context menu, select Execute Selection in Python Console , or press Alt+Shift+E :
After the code is executed on the Python console, run the coroutine by using the await keyword:
Configure Python console settings
In the Settings dialog ( Ctrl+Alt+S ), select Build, Execution, Deployment | Console | Python Console .
Select any available interpreter from the Python interpreter list. Note that you cannot introduce a new interpreter here. If you want to come up with the new interpreter, you need to create it first.
In needed, click the Configure Interpreters link to inspect the list of the installed packages and add new ones.
Mind the code in the Starting script area. It contains the script that will be executed after you open the Python console. Use it to pre-code some required Python commands.
When working on several Python scripts, you might want to execute each in a separate Python console.
Run several Python consoles
Click to add a new Python console.
By default, each console has the name Python Console with an index. To make a console reflect the script you’re running, right-click the console tab, select Rename Console , and enter any meaningful name.
All the commands you’re running in the Python console are executed one by one. If the commands require substantial time to get executed, you might want to preview and manage the execution queue.
Manage the command execution queue
Go to Settings | Build, Execution, Deployment | Console and enable the Command queue for Python Console checkbox.
Click on the console toolbar to open the queue.
In the Python Console Command Queue dialog, review the list of commands. If needed, click to delete the command from the queue.
Note, once the command is executed, it disappears from the queue. To preview all previously executed commands browse the console history ().
интерактивная отладка оболочки с помощью pycharm
Я новичок в PyCharm. Я использую простоя в течение длительного времени.
очень удобно использовать объекты Python после выполнения скрипта в режиме ожидания. Есть ли способ использовать объекты скрипта после его выполнения с помощью интерактивной оболочки python с помощью PyCharm?
например, у нас есть’ тестовый ‘ проект с одним файлом ‘test.py’:
после выполнения мы можем получить результат:
Как я могу использовать строку ‘ a ‘ с интерактивным Шелл?
8 ответов:
встроенная оболочка python для текущего сеанса отладки
- установите точку останова в строке интереса в вашем коде (т. е. щелкнув желоб) и запустите debug (щелкните правой кнопкой мыши в Редакторе, затем выберите отладка myfile.py.).
- когда точка останова будет достигнута, найдите Debug>консоль вкладка, а затем нажмите кнопку отображать командную строку (см. скриншот.)

на оценить выражение окно
в качестве более удобной альтернативы, если вам нужно только проверить некоторые переменные, члены доступа или методы вызова на объекте в области, как только точка останова достигнута, выберите выражение в текущей области, щелкните правой кнопкой мыши ->Оценить Выражение (или используйте горячую клавишу, показанную в меню под выполнить → Оценить Выражение. ), редактировать по мере необходимости — вы можете типа любой выражение python, с автоматическим завершением доступно-и затем нажмите введите (или нажмите кнопку оценить) для проверки результата.
поддерживаются несколько и многострочные выражения: для получения многострочной версии диалогового окна проверка нажмите кнопку режим фрагмента кода или выберите несколько строк кода в редакторе, а затем вычислите выражение. Вы можете присваивать значения существующим переменным (новые не могут быть определены) и запускать целые куски код. 
наведите курсор мыши на переменные
чтобы увидеть значение переменной после установки точки останова в режиме отладки, наведите указатель мыши на переменную (1-2 секунды) и значение будет показано в подсказке.

подсказка будет содержать значок-щелчок по нему откроет инспектор во всплывающем окне.

для переменные в области инспектор отображается в нижней панели под Debug>отладчик.
Install Fights in Linux
Python has an interactive console that enable to explore your code after executing the script or the command.
If you run your code without interactive option you will see this message:
Process finished with exit code 0
To activate it, go to Run/Edit Configurations . remove all configurations (to the right of plus green icon) and write -i on interpreter options from Defaults/Python.
Also, you can enable Show command line afterwards checkbox, but your script may crash with this following error, when try to read a string from the keyboard.
Exception in thread ServerThread (most likely raised during interpreter shutdown):
Process finished with exit code 1