TensorFlow在树莓派4B上安装后报错HadoopFileSystem load error的解决方法

问题重现

在树莓派上使用TensorFlow官方的命令安装完TensorFlow后用python测试是否安装成功:

$ python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

结果报出了如下错误

E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory

问题原因

不能安装1.14.0版本的Tensorflow,需要安装2.x.x或更高版本的TensorFlow

解决方

不知道安装了什么版本的Tensorflow可以用以下命令查看安装的包

 

sudo pip3 list

 

然后卸载1.14.0版本的Tensorflow

sudo pip3 uninstall tensorflow-estimator
sudo pip3 uninstall tensorflow
sudo pip3 uninstall tensorboard

再安装2.x.x版本的TensorFlow(以2.3.0为例)

sudo pip3 install https://github.com/lhelontra/tensorflow-on-arm/releases/download/v2.3.0/tensorflow-2.3.0-cp37-none-linux_armv7l.whl

如果想安装最新版本的Tensorflow,可以查看这个github仓库Release:https://github.com/lhelontra/tensorflow-on-arm/releases

根据你的树莓派版本找到对应的Assets,右键复制链接然后粘贴到命令sudo pip3 install后面

安装完成后最后测试是否成功:

python3 -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
tf.Tensor(267.6587, shape=(), dtype=float32)

引用的github issue comment: https://github.com/tensorflow/tensorflow/issues/36141#issuecomment-625958459

 

相关文章

MNIST数据集可以说是深度学习的入门,但是使用模型预测单张M...
1、新建tensorflow环境(1)打开anacondaprompt,输入命令行...
这篇文章主要介绍“张量tensor是什么”,在日常操作中,相信...
tensorflow中model.fit()用法model.fit()方法用于执行训练过...
https://blog.csdn.net/To_be_little/article/details/12443...
根据身高推测体重const$=require('jquery');const...