创客出手

目录

Jetson Nano – 自己动手搭建Jetbot环境

1. 烧JetPack镜像SD卡

1)根据官方的Jetson Nano Developer Kit
指引下载镜像,并录制到SD卡
· 使用账户密码为 Jetbot / Jetbot
· 确定系统是自动登录(免输入账户密码)
· 插入SD卡到Jetson Nano主板,开机

2)进入Terminal输入代码
开机进入界面后,按快捷键进入Terminal
Ctrl + Alt + T

3)启动 i2c 权限

// Enable i2c permissions
sudo usermod -aG i2c $USER;

2. 安装pip3、Python依赖项

// Install pip and some python dependencies
sudo apt-get update
sudo apt install python3-pip python3-pil
sudo pip3 install -U pip
sudo pip3 install -U numpy==1.16.1 future==0.17.1 mock==3.0.5 h5py==2.9.0 keras_preprocessing==1.0.5 keras_applications==1.0.6 enum34 futures testresources setuptools protobuf
sudo pip3 install --upgrade numpy 

3. 安装TensorFlow

安装TensorFlow所需的系统包

// Install system packages required by TensorFlow
sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev

正式开始安装TensorFlow

// Installing TensorFlow
sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu

验证是否安装成功:
打开Terminal,输入Python3运行,再输入

import tensorflow

如果没有报错,代表TensorFlow成功安装并运行

4. 安装 PyTorch

1)下载PyTorch的安装文件whl
超链接需翻过去下载(主编另找时间上传到百度网盘供大家直接下载)
2)Scp安装文件
通过Scp方式将文件传到Jetson Nano的用户名录下/home/jetbot

// Installing PyTorch
sudo pip3 install torch-1.0.0a0+18eef1d-cp36-cp36m-linux_aarch64.whl
sudo pip3 install torchvision

5. 安装Traitlets

// Install traitlets (master, to support the unlink() method)
sudo python3 -m pip install git+https://github.com/ipython/traitlets@master

6. 安装Jupyter Lab

// Install jupyter lab
sudo apt install nodejs npm
sudo pip3 install jupyter jupyterlab
sudo jupyter labextension install @jupyter-widgets/jupyterlab-manager
// Install jupyter lab
sudo jupyter labextension install @jupyterlab/statusbar

在这里插入图片描述
出现以上报错,忽略,继续以下

jupyter lab --generate-config
jupyter notebook password
// 设置一个密码
cd 
cd .jupyter
sudo nano jupyter_notebook_config.py

移到最后一行,添加以下内容到config

c.NotebookApp.allow_origin = ‘*’
c.NotebookApp.ip = ‘0.0.0.0’

7. 安装这个repo

cd
sudo apt install python3-smbus

//将Jetbot这项目从Github克隆下来
git clone https://github.com/NVIDIA-AI-IOT/jetbot

cd jetbot
sudo apt-get install cmake
sudo python3 setup.py install

8. 安装Jetbot服务

cd jetbot/utils
python3 create_stats_service.py
sudo mv jetbot_stats.service /etc/systemd/system/jetbot_stats.service
sudo systemctl enable jetbot_stats
sudo systemctl start jetbot_stats
python3 create_jupyter_service.py
sudo mv jetbot_jupyter.service /etc/systemd/system/jetbot_jupyter.service
sudo systemctl enable jetbot_jupyter
sudo systemctl start jetbot_jupyter

9. 创建文件交换

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'

10. 复制JetBot notebooks到home文件下

cp -r ~/jetbot/notebooks ~/Notebooks
更多关于 , 的文章
关注创客出手公众号

关注创客出手