【发布时间】:2016-11-30 20:19:54
【问题描述】:
这在 Anaconda 的 IPython 4.2.0 和 Spyder 2.3.9 中以前可以工作,但现在不行了。啊。
如果我得到 IPython 配置,它看起来是正确的,就好像它正确读取了文件:
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': ''}}
所以它应该有未来的划分和numpy抑制,但它实际上没有:
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])
这是它应该做的:
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}
常规 IPython 正常工作 (C:\Anaconda2\python.exe C:\Anaconda2\cwp.py C:\Anaconda2 "C:/Anaconda2/python.exe" "C:/Anaconda2/Scripts/ipython-script.py")
Jupyter QTConsole 工作正常 (C:\Anaconda2\pythonw.exe C:\Anaconda2\cwp.py C:\Anaconda2 "C:/Anaconda2/pythonw.exe" "C:/Anaconda2/Scripts/jupyter-qtconsole-script.py")
【问题讨论】:
-
和spyder中的this bug有关系吗?
-
@PeterBrittain 不,但这是一个很好的解决方法!
-
一个可能令人讨厌的答案(没有人想重新安装)可能是在某事上。 Anaconda 4.2 充满了错误。我参与了 github 发布问题,他们非常善于研究这些问题,尽管他们可能确实必须优先考虑计划的发布和其他人的问题,我敢肯定。 Anaconda 4.3.1 现已推出。您可能想尝试升级,看看您的问题是否得到解决。您还可以单击指向 spyder 错误的链接,然后将其跟踪到项目以发布您的问题以寻求帮助。
-
一些其他的尝试:conda update conda 和 conda update anaconda 来更新这些组件。然后 conda 更新 spyder,但请确保按此顺序更新,否则您可能会损坏 spyder,然后发现它无法正常工作。
标签: python numpy ipython anaconda spyder