AttributeError: Module 'scipy' has no attribute '_lib' 질문드립니다.

조회수 245회

KeyError Traceback (most recent call last)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\__init__.py:207, in __getattr__(name)
    206 try:
--> 207     return globals()[name]
    208 except KeyError:

KeyError: '_lib'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
Cell In[70], line 1
----> 1 from scipy import stats

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\stats\__init__.py:608
      1 """
      2 .. _statsrefmanual:
      3 
   (...)
    603 
    604 """
    606 from ._warnings_errors import (ConstantInputWarning, NearConstantInputWarning,
    607                                DegenerateDataWarning, FitError)
--> 608 from ._stats_py import *
    609 from ._variation import variation
    610 from .distributions import *

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\stats\_stats_py.py:39
     36 from numpy.lib import NumpyVersion
     37 from numpy.testing import suppress_warnings
---> 39 from scipy.spatial.distance import cdist
     40 from scipy.ndimage import _measurements
     41 from scipy._lib._util import (check_random_state, MapWrapper, _get_nan,
     42                               rng_integers, _rename_parameter, _contains_nan)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\spatial\__init__.py:110
      1 """
      2 =============================================================
      3 Spatial algorithms and data structures (:mod:`scipy.spatial`)
   (...)
    107    QhullError
    108 """
--> 110 from ._kdtree import *
    111 from ._ckdtree import *
    112 from ._qhull import *

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\spatial\_kdtree.py:4
      1 # Copyright Anne M. Archibald 2008
      2 # Released under the scipy license
      3 import numpy as np
----> 4 from ._ckdtree import cKDTree, cKDTreeNode
      6 __all__ = ['minkowski_distance_p', 'minkowski_distance',
      7            'distance_matrix',
      8            'Rectangle', 'KDTree']
     11 def minkowski_distance_p(x, y, p=2):

File _ckdtree.pyx:12, in init scipy.spatial._ckdtree()

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\__init__.py:287
    284 from ._matrix_io import *
    286 # For backward compatibility with v0.19.
--> 287 from . import csgraph
    289 # Deprecated namespaces, to be removed in v2.0.0
    290 from . import (
    291     base, bsr, compressed, construct, coo, csc, csr, data, dia, dok, extract,
    292     lil, sparsetools, sputils
    293 )

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\csgraph\__init__.py:185
    157 __docformat__ = "restructuredtext en"
    159 __all__ = ['connected_components',
    160            'laplacian',
    161            'shortest_path',
   (...)
    182            'csgraph_to_masked',
    183            'NegativeCycleError']
--> 185 from ._laplacian import laplacian
    186 from ._shortest_path import (
    187     shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson,
    188     NegativeCycleError
    189 )
    190 from ._traversal import (
    191     breadth_first_order, depth_first_order, breadth_first_tree,
    192     depth_first_tree, connected_components
    193 )

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\csgraph\_laplacian.py:7
      5 import numpy as np
      6 from scipy.sparse import issparse
----> 7 from scipy.sparse.linalg import LinearOperator
     10 ###############################################################################
     11 # Graph laplacian
     12 def laplacian(
     13     csgraph,
     14     normed=False,
   (...)
     21     symmetrized=False,
     22 ):

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\linalg\__init__.py:120
      1 """
      2 Sparse linear algebra (:mod:`scipy.sparse.linalg`)
      3 ==================================================
   (...)
    117 
    118 """
--> 120 from ._isolve import *
    121 from ._dsolve import *
    122 from ._interface import *

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\linalg\_isolve\__init__.py:4
      1 "Iterative Solvers for Sparse Linear Systems"
      3 #from info import __doc__
----> 4 from .iterative import *
      5 from .minres import minres
      6 from .lgmres import lgmres

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\linalg\_isolve\iterative.py:149
    124         return fn
    125     return combine
    128 @set_docstring('Use BIConjugate Gradient iteration to solve ``Ax = b``.',
    129                'The real or complex N-by-N matrix of the linear system.\n'
    130                'Alternatively, ``A`` can be a linear operator which can\n'
    131                'produce ``Ax`` and ``A^T x`` using, e.g.,\n'
    132                '``scipy.sparse.linalg.LinearOperator``.',
    133                footer="""\
    134                Examples
    135                --------
    136                >>> import numpy as np
    137                >>> from scipy.sparse import csc_matrix
    138                >>> from scipy.sparse.linalg import bicg
    139                >>> A = csc_matrix([[3, 2, 0], [1, -1, 0], [0, 5, 1]], dtype=float)
    140                >>> b = np.array([2, 4, -1], dtype=float)
    141                >>> x, exitCode = bicg(A, b)
    142                >>> print(exitCode)            # 0 indicates successful convergence
    143                0
    144                >>> np.allclose(A.dot(x), b)
    145                True
    146 
    147                """
    148                )
--> 149 @non_reentrant()
    150 def bicg(A, b, x0=None, tol=1e-5, maxiter=None, M=None, callback=None, atol=None):
    151     A,M,x,b,postprocess = make_system(A, M, x0, b)
    153     n = len(b)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\_lib\_threadsafety.py:57, in non_reentrant.<locals>.decorator(func)
     55     msg = "%s is not re-entrant" % func.__name__
     56 lock = ReentrancyLock(msg)
---> 57 return lock.decorate(func)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\_lib\_threadsafety.py:45, in ReentrancyLock.decorate(self, func)
     43     with self:
     44         return func(*a, **kw)
---> 45 return scipy._lib.decorator.decorate(func, caller)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\__init__.py:209, in __getattr__(name)
    207     return globals()[name]
    208 except KeyError:
--> 209     raise AttributeError(
    210         f"Module 'scipy' has no attribute '{name}'"
    211     )

AttributeError: Module 'scipy' has no attribute '_lib'

이렇게 자꾸 뜨는데 뭐가 잘못된 건가요?

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)