模块'numpy.distutils。__配置__'没有属性'blas_opt_info'

问题描述

我正在尝试研究神经网络和深度学习(http://neuralnetworksanddeeplearning.com/chap1.html)。使用MichalDanielDobrzanski为Python3更新的版本(https://github.com/MichalDanielDobrzanski/DeepLearningPython)。我试图在我的命令控制台中运行它,但它给出了下面的错误。我试着卸载并重新安装setupTools、Theano和NumPy,但到目前为止都没有成功。如有任何帮助,不胜感激!!

以下是完整的错误日志:

WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`
C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heanoconfigdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
  warnings.warn("DeprecationWarning: there is no c++ compiler."
WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
Traceback (most recent call last):
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heanoconfigparser.py", line 168, in fetch_val_for_key
    return theano_cfg.get(section, option)
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libconfigparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libconfigparser.py", line 1149, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'blas'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heanoconfigparser.py", line 327, in __get__
    val_str = fetch_val_for_key(self.fullname,
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heanoconfigparser.py", line 172, in fetch_val_for_key
    raise KeyError(key)
KeyError: 'blas.ldflags'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:UsersASUSDocumentsGitHubNeural-network-and-deep-learning-but-for-python-3	est.py", line 156, in <module>
    import network3
  File "C:UsersASUSDocumentsGitHubNeural-network-and-deep-learning-but-for-python-3
etwork3.py", line 37, in <module>
    import theano
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heano\__init__.py", line 124, in <module>
    from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heanoscan_module\__init__.py", line 41, in <module>
    from theano.scan_module import scan_opt
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heanoscan_modulescan_opt.py", line 60, in <module>
    from theano import tensor, scalar
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heano	ensor\__init__.py", line 17, in <module>
    from theano.tensor import blas
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heano	ensorlas.py", line 155, in <module>
    from theano.tensor.blas_headers import blas_header_text
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heano	ensorlas_headers.py", line 987, in <module>
    if not config.blas.ldflags:
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heanoconfigparser.py", line 332, in __get__
    val_str = self.default()
  File "C:UsersASUSAppDataLocalProgramsPythonPython39libsite-packages	heanoconfigdefaults.py", line 1284, in default_blas_ldflags
    blas_info = np.distutils.__config__.blas_opt_info
AttributeError: module 'numpy.distutils.__config__' has no attribute 'blas_opt_info'

解决方案

我遇到了同样的问题,通过以下方式解决了将NumPy降级到1.20.3版本的问题:

pip3 install --upgrade numpy==1.20.3

相关文章