Command window in Pycharm
Solution 1
Short answer from the docs:
To launch an interactive console On the main menu, choose Tools | Run Python console.
Description:
REPL console
PyCharm also helps those who love the full control of an interactive console: on the Tools menu, you can find commands that launch the interactive Python or Django consoles. Here you can type commands and execute them immediately. Moreover, PyCharm's interactive consoles feature syntax highlighting, code completion, and allow viewing the history of commands (Ctrl+Alt+E or Up/Down arrows while in the editor).
PyCharm also makes it possible to run in console source code from the editor — just make your selection, and then press Shift+Alt+E (Execute selection in console on the context menu of the selection).
Independent of Pycharm, you can also access the REPL in the terminal (or cmd
shell on Windows) by typing
python
at the prompt.
Solution 2
In PyCharm, you navigate to the View -> Tool Windows
menu and toggle the Terminal
window See image here. It will likely show up at the bottom of your IDE window.
Another very good (and more general option) is to use IDLE. From its Wikipedia entry...
IDLE is intended to be a simple IDE and suitable for beginners, especially in an educational environment. To that end, it is cross-platform, and avoids feature clutter.
It ships with basically every standard version of Python since 1.5.2 so I'm pretty sure you have it available on your system (I've checked with Linux and Mac OS X).
- To fire up IDLE in Python2, enter:
/path/to/python/bin/idle
where/path/to/python/bin
is where you find the Python executable. - For Python3, use
idle3
instead.
You should see a new separate terminal window open up (with syntax highlighting and all!)See image here.
![Ancalagon BerenLuthien](https://i.stack.imgur.com/7tG04.jpg?s=256&g=1)
Ancalagon BerenLuthien
Updated on June 04, 2022Comments
-
Ancalagon BerenLuthien about 2 years
Is there a interface in Pycharm where we can simply type in some commands and run it ? Something like in Matlab, we can type in "a = 1; b = 2; c = a+b" then we get ans=3.
Thanks PS: we know we can create a python file in Pycharm and run it, e.g., "a = 1; b = 2; c = a+b; print(c)" but it is not as convenient as a command window.