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 Control+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 ( Control+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 ().
Python console
Python console enables executing Python commands and scripts line by line, similar to your experience with Python Shell.
Actions available in the Python Console
In the console, you can:
Type commands and press Enter to execute them. Results are displayed in the same console.
Use basic code completion Control+Space and tab completion.
Use the await keyword to run asyncio coroutines.
Use Up and Down arrow keys to scroll through the history of commands, and execute the required ones.
Load source code from the editor into console.
Use the context menu to copy the contents of the console to the clipboard, compare it with the clipboard, or clear the console.
Use the toolbar buttons to control your session in the console.
Configure color scheme of the console to meet your preferences. Refer to the section Configure color schemes for consoles for details.
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 Control+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 ( Control+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 ().
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
Работа в IDE PyCharm (FAQ) + полезные фишки
Twitter, Pinterest, HP, Symantec, Groupon. Как думаете, что у них общего ? Не сомневаюсь, ответ вам известен. Но помимо того, что это крупнейшие на мировом IT-рынке компании, есть и более специфичная деталь: те их сотрудники, кто программирует на языке Python, пишут свой код в среде разработки PyCharm .
Талантливые ребята из JetBrains разработали одну из наиболее используемых IDE в мире для этого языка программирования.
В начале 2019 года компания JetBrains опросила почти 7000 разработчиков. 42% опрошенных, которые пишут на Python, выбрали PyCharm как основную IDE для своей работы.
PyCharm кроссплатформенна и совместима с Windows, Linux и MacOS. Она поддерживает, как вторую, так и третью версию Питона и, кроме всего прочего, имеет красивый и функциональный UI.
Инструменты и функции, предоставляемые этой интегрированной средой, помогают Python-программистам быстро и эффективно писать код, синхронизироваться с системой контроля версий, использовать фреймворки и плагины, позволяя при этом настроить интерфейс так, как удобно самому пользователю и даже дают возможность дополнительного расширения IDE.
В PyCharm, конечно же, есть встроенный анализатор кода, который действительно помогает при его написании. Благодаря анализатору можно весьма комфортно перемещаться по проекту, использовать быстрый поиск, а также исправлять ошибки, которые PyCharm любезно подсвечивает и подробно описывает.
Тут реализованы системы автодополнения и контроля качества кода в соответствии со стандартом PEP8. Всё для того, чтобы сделать текст ваших программ красивее, чище и структурированнее.
В интегрированной среде от JetBrains поддерживаются основные современные Python-фреймворки для веб-разработки, в ней вы сможете работать с Jupyter-notebook, подключать Anaconda, а также прочие библиотеки для научных вычислений и Data Science. Но, как говорится — "И это ещё не всё!". Помимо, собственно, питона, PyCharm отлично ладит и с другими языками программирования — JS, TypeScript-а, SQL или шаблонизаторами.
Системные требования
Официальные системные требования последней версии PyCharm выглядят так:
- Windows — Microsoft Windows 10 64-битили Windows 8 64-бит;
- macOS — macOS 10.13 или выше;
- Linux — среда GNOME или KDE.
RAM: не менее 2 ГБ, но рекомендуется 8 ГБ;
Место на диске: установка потребует 2,5 ГБ, рекомендуется использование SSD;
Разрешение экрана : не менее 1024×768 пикселей;
Python: Python 2.7, Python 3.5 или более поздняя версия;
При этом разработчики обращают внимание пользователей macOS и Linux на то, что JBR 11 поставляется в комплекте с PyCharm, и дополнительно устанавливать Java им не нужно.
В самих системных требованиях нет ничего особенного, однако хочется отметить, что IDE прекрасно себя чувствует и на Windows 7, а к рекомендациям по поводу 8 ГБ оперативной памяти и использования SSD стоит тщательным образом прислушаться, не прогадаете .
Как установить
Процесс установки вкратце описан на официальном сайте для каждой из поддерживаемых ОС:
На Windows
- Запускаете файл pycharm.exe .
- Следуете инструкциям инсталл-мастера.
- Выбираете нужные параметры установки.
- Готово.
На Mac OS
- Сперва следует скачать файл pycharm.dmg .
- Затем смонтировать диск в вашей системе.
- И, наконец, необходимо скопировать PyCharm в Applications.
На Linux
- Файл pycharm.tar.gz нужно скопировать в выбранную папку.
- Обязательно убедитесь, что у вас есть права доступа RW для данного каталога.
- Распакуйте pycharm.tar.gz используя команду: tar -xzf pycharm-2020.1.2.tar.gz
- Будьте внимательны: архив НЕЛЬЗЯ РАСПАКОВЫВАТЬ в папку с существующей инсталляцией.
- Теперь можно запустить pycharm.sh из каталога bin .
Подготовка к работе и настройка
Перед тем, как приступить к разработке в PyCharm, вам нужно создать проект, поскольку все дальнейшие манипуляции будут происходить именно в нём и на его основе.
Чтобы начать новый проект, нажмите New Project и придумайте ему имя. Теперь можно приступить к настройке.
Настройки интерфейса
Несмотря на то, что разработчики из JetBrains начинали свой путь в России, смена языка интерфейса в среде разработки не предусмотрена, поэтому к вашим услугам будет лишь родной язык Уильяма Шекспира.
Зато вы можете изменить сами шрифты и их размеры, пройдя по пути:
File -> Settings -> editor -> font
Поменять цветовую схему UI:
File -> Settings -> editor -> color scheme
И сконфигурировать множество других аспектов, вроде общих настроек, конфигураций прокрутки, настроек цвета для каждого доступного языка и так далее. Для всего этого есть редактор:
file -> settings -> editor
Настройка интерпретатора
Скачать интерпретатор вы можете с официального сайта Python . Если в ваши планы не входит работа с библиотеками, которые есть только во второй версии языка, то стоит качать последний релиз Python 3.