Two ways:
1. Add the following two lines (valid only for the current file) at the beginning of each new file:
from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all"
2. Direct Add Profile (valid for all files):
vi ~/.ipython/profile_default/ipython_config.py
Configuration file as follows:
c = get_config() #Run all nodes interactively c.InteractiveShell.ast_node_interactivity = "all"
Results are as follows: