Jetson Nano configuration process (2)

Jetson Nano configuration process (2)

The last part wrote about the environment configuration, this article will continue to write about the installation of some python libraries.

1. Install pinyin, pip, python3 and change to default

Need to ssh to transfer files, need to install lrzsz.

#安装lrzsz
sudo apt-get install lrzsz

#Language support to choose Chinese (used in graphical interface, no need to install)

sudo apt-get install ibus-pinyin
reboot

Install pip, pip replaces Ali source

sudo apt-get install python3-pip

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

python -m pip install --upgrade pip

Comes with python2 and python3, set Python3 as the default.

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

verification

python --version
 #显示这个就说明切换成功
Python 3.6.5

2. Jetson Nano Swap swap space increased

Jetson Nano's memory is 4G, and the video memory and memory share mechanism. The swap space can be increased by 4G, and some program errors that run out of memory can be solved.

Enter the following commands in sequence and make them permanent.

sudo fallocate -l 4G /var/swapfile
sudo chmod 600 /var/swapfile
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
sudo bash -c 'echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab'

3. Installation of some Python calculation libraries

Here you need to install numpy, pandas, scipy, h5py, tensorflow-gpu, pytorch; some libraries are pre-downloaded, tensorflow-gpu version is 1.13.1, pytorch is 1.4.0, and other versions can be downloaded from the official website; I The installed library can be picked up by Baidu Netdisk:

https://pan.baidu.com/s/1FUWfLriHrqMSDr7l61tBBQ File code: s7ty

#有点慢,需要等待10分钟左右
pip install numpy==1.17.2
#非常慢,大概需要半个小时
pip install pandas   
#matlotlib,sklearn
sudo apt-get install python3-matplotlib python3-sklearn

Here you need to install h5py first, otherwise you will install tensorflow-gpu and you will get an error.

sudo apt-get install python3-h5py
#scipy安装
pip install scipy-1.2.0-cp36-cp36m-linux_aarch64.whl
#tensorflow-gpu安装
pip install tensorflow_gpu-1.13.1+nv19.3-cp36-cp36m-linux_aarch64.whl

After installing tensorflow-gpu, you need to test under this python to see if the installation is successful.

import tensorflow as tf 
# 判断CUDA是否可以用
a = tf.test.is_built_with_cuda()  
# 判断GPU是否可以用 
b = tf.test.is_gpu_available( cuda_only=False, min_cuda_compute_capability=None )
print(a) 
print(b)

The output here is True, indicating that the tensorflow-gpu installation was successful.

pytorch 1.4.0 torchvision 0.5.0 installation

#安装依赖
sudo apt-get install  libopenblas-base
sudo apt-get install libjpeg-dev zlib1g-dev
pip install Cython
#安装下载好pytorch库
pip install torch-1.4.0-cp36-cp36m-linux_aarch64.whl
# 下载torchvision
git clone -b v0.5.0 https://github.com/pytorch/vision torchvision
# 编译安装torchvision
cd torchvision
sudo python setup.py install

After a long wait, enter the python environment to check whether torch is available.

import torch
# 判断CUDA是否可以被torch正常调用
print(torch.cuda.is_available() ) 

At this point, some mainstream deep learning libraries have been installed so far, and some libraries such as keras can be installed directly using pip; because the OpenCV that comes with the system is .4 version without dnn module, an Opencv 4.1.1 will be written in the next issue Compile and install the process.

Guess you like

Origin blog.csdn.net/djj199301111/article/details/107585151