【发布时间】:2020-04-21 08:40:28
【问题描述】:
我无法理解为什么以下访问scipy.sparse.linalg.norm 的方法分别有效和无效:
(base) ➜ ~ ipython
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from scipy import sparse
In [2]: sparse.linalg.norm
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-bfa688e1c7b4> in <module>
----> 1 sparse.linalg.norm
AttributeError: module 'scipy.sparse' has no attribute 'linalg'
In [3]: from scipy.sparse.linalg import norm
In [4]: import scipy; scipy.__version__
Out[4]: '1.4.1'
谁能解释一下?
另外,我想我记得过去直接使用过 sparse.linalg.norm,它工作得很好。
【问题讨论】: