(2) Jetson Nano development: Tensorflow download and installation (many details)

(2) Jetson Nano development: Tensorflow download and installation (many details)

Write in front

1. This article aims to install Tensorflow-gpu 1.13.1+nv19.3 .
Note: Please refer to point 3 of this article for "Why version 1.13.1?"
2. Before downloading and installing Tensorflow in Jetson Nano, first download and install JetPack 4.2 version (please refer to the previous article (1) Jetson Nano Development: JetPack Download and Installation (many details)) before you can use Ubuntu 18.04.
3. Regarding Tensorflow-gpu installation, there are strict requirements for cuda .
The JetPack version determines the version of cuda, and the JetPack version is not higher or higher, but to consider compatibility with Python, Keras, etc. The latest version of JetPack (such as JetPack4.4) just can’t meet this compatibility well. Therefore, this article chose JetPack4.2 version, cuda10.0 version, python3.6 version, keras2.2.4 version (successfully installed).
4. If you are using JetPack4.4, then the most time-saving way is...It is recommended to reformat the SD card and download and install JetPack4.2 ("How to download and install JetPack4.2" please refer to the previous article (1) Jetson Nano development: JetPack download and install (many details)).
5. After installing JetPack 4.2 version , start the following operations!

Open terminal

After entering the system, use the shortcut key Ctrl+Alt+T to open the terminal.

Check cuda

1. Without doing any operation, enter nvcc -V on the terminal (note: V is a capital letter), press Enter, the following content will be displayed, don't be afraid;

bash: nvcc: 未找到命令

2. Switch to the root directory at this time, that is, enter cd ~ in the terminal, and press Enter;
3. Use vim (included in the system, no need to download and install) to open the .bashrc file, that is, enter: vim.bashrc in the terminal, press Enter ;
4. Press the i key on the keyboard to enter the editing state;
5. Add the following three lines of code at the end of the file;

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_ROOT=/usr/local/cuda

6. Press the Esc key on the keyboard, then enter the colon on the keyboard, and then press wq! character (for forced writing and exit), press Enter;
7. Enter source.bashrc in the terminal, press Enter;
8. On the terminal Enter nvcc -V (note: V is a capital letter), press Enter, the version of cuda will be displayed, as follows.

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on 据用户而定
Cuda compilation tools, release 10.0, V10.0.据用户而定

Update and install pip3

1. Enter the following code in the terminal, update and install some components;

$ sudo apt-get update
$ sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran

2. Enter the following code in the terminal to install pip3;

$ sudo apt-get install python3-pip
$ sudo pip3 install -U pip testresources setuptools==49.6.0

3. Enter the following code in the terminal to install some libraries or components required by Python.

$ sudo pip3 install -U numpy==1.16.1 future==0.18.2 mock==3.0.5 h5py==2.10.0 keras_preprocessing==1.1.1 keras_applications==1.0.8 gast==0.2.2 futures protobuf pybind11

Install Tensorflow-gpu

1. The wireless WIFI network card is easy to disconnect and download is very slow. It is recommended to use a network cable to connect to the Internet. During the download process, a warning caused by poor network will appear. Don't be afraid. Try several times and wait for the download to finish;
2. Terminal Enter the following code to install Tensorflow 1.13.1.

$ sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu==1.13.1+nv19.3

Install keras

1. Enter the following code in the terminal to install keras2.2.4;

$ pip install keras==2.2.4

2. After installing keras 2.2.4, check the installation results, enter python3 in the terminal and press Enter;
3. After >>> appears in the terminal, enter import keras and press Enter.
If it prompts using TensorFlow backend below, it means that keras is installed successfully.

Run Python code

Open the terminal and enter python XX.py (XX.py is the name of the Python file where the code is located) to get the running result of the Python file.

Guess you like

Origin blog.csdn.net/Echoshit8/article/details/110954777