How can I launch ipython from shell, by running ‘python …’?

To start IPython shell directly in Python:

from IPython import embed

a = "I will be accessible in IPython shell!"

embed()

Or, to simply run it from command line:

$ python -c "from IPython import embed; embed()"

embed will use all local variables inside shell.

If you want to provide custom locals (variables accessible in shell) take a look at IPython.terminal.embed.InteractiveShellEmbed

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)