【问题标题】:scipy does not load correctly in pycharmscipy 无法在 pycharm 中正确加载
【发布时间】:2016-06-10 22:42:49
【问题描述】:

我在 pycharm 中通过这个命令导入了 scipy

import scipy as sp

但我想以这种方式使用它,例如:

a=sp.special.factorial(5)

我收到一个与模块属性相关的错误,我必须仅以以下方式导入 scipy,以免出现错误:

from scipy import special

但在像 Spyder 这样的另一个 IDE 中,这两个命令都可以正常运行。
我在 pycharm 中使用 anaconda 作为解释器。

【问题讨论】:

    标签: python scipy pycharm anaconda


    【解决方案1】:

    我不熟悉 Spyder。也许他们做了一些额外的事情。但官方的做法是你必须单独import scipy.special

    import scipy
    help(scipy)  # it will give the following help message.
    

    关于 scipy 包的帮助:

    名称 scipy

    描述 SciPy:Python 的科学计算包 ================================================

    Documentation is available in the docstrings and
    online at http://docs.scipy.org.
    
    Contents
    --------
    SciPy imports all the functions from the NumPy namespace, and in
    addition provides:
    
    Subpackages
    -----------
    Using any of these subpackages requires an explicit import.  For example,
    ``import scipy.cluster``.
    

    【讨论】:

      猜你喜欢
      • 2019-01-09
      • 1970-01-01
      • 2019-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-21
      • 2018-12-15
      相关资源
      最近更新 更多