Run using IPython
and then type .
in empty julia>
prompt or run
IPython.start_ipython()
. If you are using IPython 7.0 or above, you
can switch back to Julia REPl by backspace
or ctrl-h
key (like
other REPL modes). For older versions of IPython, exiting IPython as
usual (e.g., ctrl-d
) brings you back to the Julia REPL. Re-entering
IPython keeps the previous state. Use pre-defined Main
object to
access Julia namespace from IPython.
Note: First launch of IPython may be slow.
- PyCall
- IPython (7.0 or above is recommended)
If simple Main.eval("...")
and Main.<name>
accessor is not enough,
PyJulia is a nice way to access Julia objects from Python. For
example, you can import any Julia package from Python:
>>> from julia import Base
>>> Base.banner()
Note: Until PyJulia 0.2 is released, I recommend using the master branch of PyJulia. See: JuliaPy/pyjulia#198
For more advanced/experimental Julia-(I)Python integration, see
ipyjulia_hacks
.
If you want IPython prompt to look like a part of Julia prompt, then add
the following snippet in ~/.ipython/profile_default/ipython_config.py
:
try:
from ipython_jl.tools import JuliaModePrompt
except ImportError:
pass
else:
c.TerminalInteractiveShell.prompts_class = JuliaModePrompt
Then the prompt would then look like ipy 1>
instead of In [1]:
.
It also removes Out[1]
. Note that above setting does not change
your normal IPython prompts.