Domanda

I would like ipython to add

from __future__ import division

by default when I run it.

I tried

ipython profile create

and then

emacs /home/foo/.config/ipython/profile_default/ipython_config.py

However I can't tell what I should change in this file. I am using ubuntu.

È stato utile?

Soluzione

Add the following line to the file:

c.InteractiveShellApp.exec_lines = ['from __future__ import division']

Altri suggerimenti

Maybe try

ipython -c 'from __future__ import division' -i

Here is what works for me. Open the file $HOME/.ipython/ipy_user_conf.py, add these lines:

import IPython.ipapi
ip = IPython.ipapi.get()
ip.options.autoexec.append('from __future__ import division')
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top