安装d2l包后import tensorflow as tf 时报以下错误
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
解决方法:升级numpy到最新版本
pip install numpy --upgrade
查看版本
pip list |grep numpy
# numpy 1.23.5
原因分析:
numpy是作为构建依赖项安装的,后来安装d2l包时被固定版本(numpy==1.21.5)替换,导致了上面显示的“编译冲突”文章来源:https://www.toymoban.com/news/detail-586147.html
注:tensorflow 和 d2l 可能存在的依赖项冲突如下(目前仅发现numpy对tensorflow有影响,其他三个包对tensorflow暂无)文章来源地址https://www.toymoban.com/news/detail-586147.html
d2l 0.17.6 requires matplotlib==3.5.1, but you have matplotlib 3.5.2 which is incompatible.
d2l 0.17.6 requires numpy==1.21.5, but you have numpy 1.21.6 which is incompatible.
d2l 0.17.6 requires pandas==1.2.4, but you have pandas 1.4.2 which is incompatible.
d2l 0.17.6 requires requests==2.25.1, but you have requests 2.27.1 which is incompatible.
到了这里,关于解决RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!