Note: As of the 20.02 TensorFlow release, the package name has changed from tensorflow-gpu to tensorflow. See the section on Upgrading TensorFlow for more information.
Install TensorFlow using the pip3 command. This command will install the latest version of TensorFlow compatible with JetPack 4.4.
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v44 tensorflow
Note: TensorFlow version 2 was recently released and is not fully backward compatible with TensorFlow 1.x. If you would prefer to use a TensorFlow 1.x package, it can be installed by specifying the TensorFlow version to be less than 2, as in the following command:
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v44 ‘tensorflow<2’
If you want to install the latest version of TensorFlow supported by a particular version of JetPack, issue the following command:
$ sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v$JP_VERSION tensorflow
Jetson TX2 安装Tensorflow 出现Failed cleaning build dir for scipy
在ARM架构下的scipy本身就是一个很难安装的软件包
利用pip3 install TensorFlow 的时候,出现了run scipy setup.py \. 然后蹦出来了Failed cleaning build dir for scipy
查了好多资料,可以安装下面的依赖包,就可以成功的安装keras了
sudo apt-get install python3-scipy
sudo apt-get install libblas-dev liblapack-dev
sudo apt-get install gfortran
解决tensoflow2.x中使用tf.contrib.slim包时出现的No module named:tensorflow.contrib 问题
Tensorflow2.x 版本较1.x版本有了很大的变动,以使TensorFlow用户更加高效。其中 tf.contrib 被完全弃用了是 2.x版本的一个重大的变化,但 import tensorflow.contrib.slim as slim slim 作为一个高级封装,已经在很多之前的版本中广泛使用。现在大部分的源码还是以tensorflow1.x版本为基础写的,这导致了一些已经在2.x版本中移除的模块无法使用。
主要问题:在运行import tensorflow.contrib.slim as slim时
出现了:ModuleNotFoundError: No module named 'tensorflow.contrib 错误
解决方案
经查询现有的解决方案,大部分采用了降低版本的方法,如果想采用此方法可以自己去查询。
因为不想采用降低版本的方法进行解决,经过搜索在github中查询到此信息
链接: tf.contrib.slim is not worked in tensorflow 2.0 what is the alternative for that?.
Tf-slim 有一个独立于 tensorflow 的镜像可以以 tf.compat.v1 兼容模式下使用,安装该包即可
TF-Slim是一个轻量级的库,用于在TensorFlow中定义,训练和评估复杂的模型。tf-slim的组件可以与本机tensorflow以及其他框架自由混合。
这里可以查询到关于Slim的信息: link.
在cmd中使用pip下载TF-Slim
pip install --upgrade tf_slim
使用Slim库时注意:
#import tensorflow.contrib.slim as slim
import tf_slim as slim