This used to work, but now it doesn't, in IPython 4.2.0 and Spyder 2.3.9 from Anaconda. Argh.
If I get the IPython config it looks correct, as though it read the file correctly:
get_ipython().config
Out[1]:
{'IPCompleter': {'greedy': True},
'IPKernelApp': {'exec_lines': ['%pylab qt']},
'InlineBackendConfig': {},
'InteractiveShell': {'xmode': 'Plain'},
'InteractiveShellApp': {'exec_lines': ['from __future__ import division',
'from __future__ import print_function',
'from __future__ import with_statement',
'from numpy import set_printoptions',
'set_printoptions(suppress=True, precision=4)',
'from sympy import init_printing',
'init_printing(forecolor="White")'],
'pylab': 'auto'},
'StoreMagics': {'autorestore': True},
'ZMQInteractiveShell': {'autocall': 0, 'banner1': ''}}
So it's supposed to have future division and numpy suppression, but it actually doesn't:
division
Out[1]: _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
4/5
Out[2]: 0
np.get_printoptions()
Out[3]:
{'edgeitems': 3,
'formatter': None,
'infstr': 'inf',
'linewidth': 75,
'nanstr': 'nan',
'precision': 8,
'suppress': False,
'threshold': 1000}
eps = np.finfo(float).eps; x = np.arange(4.); x**2 - (x + eps)**2
Out[4]:
array([ -4.93038066e-32, -4.44089210e-16, 0.00000000e+00,
0.00000000e+00])
This is what it should do:
from __future__ import division
division
Out[2]: _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
4/5
Out[3]: 0.8
np.set_printoptions(suppress=True)
eps = np.finfo(float).eps; x = np.arange(4.); x**2 - (x + eps)**2
Out[5]: array([-0., -0., 0., 0.])
np.get_printoptions()
Out[6]:
{'edgeitems': 3,
'formatter': None,
'infstr': 'inf',
'linewidth': 75,
'nanstr': 'nan',
'precision': 8,
'suppress': True,
'threshold': 1000}
Regular IPython works correctly ( C:\\Anaconda2\\python.exe C:\\Anaconda2\\cwp.py C:\\Anaconda2 "C:/Anaconda2/python.exe" "C:/Anaconda2/Scripts/ipython-script.py"
)
Jupyter QTConsole works correctly ( C:\\Anaconda2\\pythonw.exe C:\\Anaconda2\\cwp.py C:\\Anaconda2 "C:/Anaconda2/pythonw.exe" "C:/Anaconda2/Scripts/jupyter-qtconsole-script.py"
)
im not sure what is the problem either I was having the same issue
but mine was fixed when I uninstalled anaconda with EVERYTHING including its python bit granted I saved the settings and profile and stuff
and reinstalled
Hope that helps, if its an option at all
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.