tx2 jetpack4.2 安裝tensorflow-gpu

TX2 (JetPack4.2)安裝TensorFlow-gpu有個問題:4.2刷機安裝的cudnn是7.3版本的,而tensorflow1.14及其以上需要的是7.4以上的cudnn

安裝版本:JetPack4.2
更換cudnn版本:https://blog.csdn.net/qq_42608626/article/details/106927046

1.安裝java

sudo apt-get install openjdk-8-jdk
java -version
配置環境
which javac //查找javac可執行文件
file /usr/bin/javac // 查看鏈接目標
file /etc/alternatives/javac // 查看鏈接目標
file /usr/lib/jvm/java-8-openjdk-arm64/bin/javac
sudo gedit ~/.bashrc
// 將下面的代碼粘貼到最後
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source ~/.bashrc

2.安裝bazel(未安裝也成功了)

bazel官方提供的下載地址:https://github.com/bazelbuild/bazel/releases?after=0.10.0

Step 1: Install required packages
First, install the prerequisites: pkg-config, zip, g++, zlib1g-dev, unzip, and python.

sudo apt-get install pkg-config zip g++ zlib1g-dev unzip python
Step 2: Download Bazel
Next, download the Bazel binary installer named bazel--installer-linux-x86_64.sh from the Bazel releases page on GitHub.

Step 3: Run the installer
Run the Bazel installer as follows:

chmod +x bazel--installer-linux-x86_64.sh
./bazel--installer-linux-x86_64.sh --user
The --user flag installs Bazel to the $HOME/bin directory on your system and sets the .bazelrc path to $HOME/.bazelrc. Use the --help command to see additional installation options.

Step 4: Set up your environment
If you ran the Bazel installer with the --user flag as above, the Bazel executable is installed in your $HOME/bin directory. It’s a good idea to add this directory to your default paths, as follows:

export PATH=“PATH:PATH:HOME/bin”
You can also add this command to your ~/.bashrc file.

Note: Bazel includes an embedded JDK, which can be used even if a JDK is already installed. bazel--without-jdk-installer-linux-x86_64.sh is a version of the installer without an embedded JDK. Only use this installer if you already have JDK 8 installed. Later JDK versions are not supported.

其它依賴項
sudo apt-get install zip unzip autoconf automake libtool curl zlib1g-dev maven
sudo apt-get install python3-numpy swig python3-dev  python3-wheel python3-h5py

2.安裝pip3

源碼編譯

首先,到官網下載最新的.tar.gz壓縮包,解壓並進入到文件夾中,使用下面的命令安裝pip3

sudo python3 setup.py install

如果它報出缺少setuptools這樣的問題,
而且你已經執行過’sudo apt-get install python3-pip’命令了,可以輸入下面的命令安裝setuptools:

pip3 install setuptools

果你沒有執行過’sudo apt-get install python3-pip’的命令,那麼可以執行下面的命令來安裝setuptools:

 sudo apt-get inatall python3-setuptools

然後再重新運行安裝腳本。

3.下載安裝TensorFlow-gpu

3.1 到官網下載jetpack4.2對應版本的tensorflow

網址:https://developer.nvidia.com/embedded/downloads#?search=tensorflow

3.2 安裝
pip3 install tensorflow_gpu-1.14.0+nv19.7-cp36-cp36m-linux_aarch64.whl --user

參考文章:https://blog.csdn.net/macunshi/article/details/86813885

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章