AttributeError: module 'numpy.core.multiarray' has no attribute 'get_ndarray_c_version' theano keras

本文介绍了解决Theano与NumPy版本不兼容导致的错误module'numpy.core.multiarray'hasnoattribute'get_ndarray_c_version'的方法。提供两种解决方案,一种是下载并手动安装特定版本的Theano,另一种是在Theano源代码中修改特定行以适配当前的NumPy版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

import theano 之后 出现   module 'numpy.core.multiarray' has no attribute 'get_ndarray_c_version' 

 

https://stackoverflow.com/questions/55046335/numpy-attributeerror-with-theano-module-numpy-core-multiarray-has-no-attribut

This is a known bug presumably caused by changes introduced in NumPy. A fix for this was introduced in Theano v1.0.4. So, either you need to upgrade to at least that version of Theano, or downgrade NumPy to below v1.16.

stackoverflow 某大神的解释如上。

 

conda list 后查看了下  theano 版本为 1.0.3  ,输入 conda update theano 没有用。

numpy降版本不方便。

 

解决办法:

------------------------------------------------------------------------------------------------------------------

https://anaconda.org/conda-forge/theano/files  下载对应的离线安装包

比如我的是win64 下载的是 win-64/theano-1.0.4-py27hc56fc5f_1000.tar.bz2  

到下载的文件夹 shift+右击 进入 powershell 

输入 :

conda install --use-local theano-1.0.4-py27hc56fc5f_1000.tar.bz2

------------------------------------------------------------------------------------------------------------------

上述方法会导致 prompt 闪退 

"Did not find VS in registry or in VS140COMNTOOLS env var - exiting"

具体修复方法 :

conda uninstall vs2015_win-64

https://stackoverflow.com/questions/53635462/anaconda-prompt-closes-immediately-the-system-was-unable-to-find-the-specified

 

 

新解决办法:

到    Anaconda3\pkgs\theano-1.0.3-py37_0\Lib\site-packages\theano\gof  文件夹下面,打开 cc.py 文件。

定位到1376行(ctrl+g),注释掉

sig.append('NPY_ABI_VERSION=0x%X' %
        np.core.multiarray._get_ndarray_c_version())

如图:

https://github.com/MichalDanielDobrzanski/DeepLearningPython35/issues/20

https://www.wandouip.com/t5i268914/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值