【问题标题】:Why doesn't Spyder obey my IPython config file?为什么 Spyder 不服从我的 IPython 配置文件?
【发布时间】: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


【解决方案1】:

我也不确定是什么问题 我遇到了同样的问题

但是当我卸载 anaconda 时,我的问题已修复,包括它的 python 位在内的所有内容 授予我保存设置和配置文件和东西

重新安装

希望对您有所帮助,如果可以的话

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-10
    • 1970-01-01
    • 2011-01-15
    • 1970-01-01
    • 2017-10-06
    • 2011-06-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多