Jetson Nano配置踩坑全记录
Jetson Nano相关参数:JetPack 4.6,cuda 10.2, SD卡内存:512G
一、Jetson Nano系统镜像烧录
- 在Nvidia官网下载Jetson Nano的系统镜像: https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit%23write
- 在Ubuntu PC上使用SD烧录软件Etcher将下载的image烧录至SD卡(SD卡内存推荐大点的,不然会出现内存不够用的情况)
- 给Jetson Nano连接键盘、鼠标,上电并启动,在Ubuntu系统设置界面语言选择中文,选择英文键盘布局,其余默认,完成后进入Ubuntu系统
二、Ubuntu系统设置
- 将Ubuntu系统中的中文文件夹更名为英文,打开终端,在终端输入以下命令:
$ export LANG=en_US
$ xdg-user-dirs-gtk-update
跳出对话框询问是否将目录转化为英文路径,同意并关闭
$ export LANG=zh_CN
重启系统,会提示是否把改名的目录改回中文,勾选不再提示,并选择Keep Old Name
- 更新Ubuntu系统
$ sudo apt-get update
$ sudo apt-get upgrade
- 若需要节省空间,可以将内置的Libre Office卸载:
$ sudo apt-get purge libreoffice*
$ sudo apt-get clean
- 更换apt源为国内源(可选)
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
$ sudo gedit /etc/apt/sources.list
将文件内容清空,输入以下内容:
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
- 更换python版本
$ sudo apt-get install python3.8
$ update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
$ update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2
$ sudo apt-get install python3-pip python3-dev
$ python3 -m pip install --upgrade pip
- 终端调节pwm风扇转速
$ sudo sh -c ‘echo 255 > /sys/devices/pwm-fan/target_pwm’
关闭风扇:
$ sudo sh -c ‘echo 0 > /sys/devices/pwm-fan/target_pwm’
改变风扇转速: 更改echo后的值即可,范围1-255(越大转速越快)
- cuda配置
$ sudo gedit ~/.bashrc
在文件末尾添加以下路径:
export CUDA_HOME=/usr/local/cuda-10.2
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10.2/bin:$PATH
$ source ~/.bashrc
查看cuda版本:
$ nvcc -V
- locate安装和使用
$ sudo apt-get install locate
更新数据库
$ sudo updatedb
若更新数据库提示 /usr/bin/find: ‘/run/user/1000/gvfs’: Permission denied /usr/bin/find: ‘/run/user/120/gvfs’ : Permission denied
$ sudo umount /run/user/1000/gvfs
$ sudo umount /run/user/120/gvfs
$ sudo rm -rf /run/user/1000/gvfs
$ sudo rm -rf /run/user/120/gvfs
- 查找某个文件位置
$ sudo find / -name ***
- 安装中文输入法
1、打开系统设置;
2、选择语言支持;
3、提示语言支持没有安装完整,点击安装;
4、在终端输入:
$ sudo apt-get install fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin-y
5、在语言支持-语言-键盘输入法系统选择fctix,重启生效
6、重启后,在系统桌面的右上角点击当前输入法的配置,对fcitx的输入法进行配置,添加已安装的googlepinyin
若配置完输入法没有候选框,在终端输入以下指令,再重启即可
$ sudo fcitx-module-kimpanel
- 安装软件提示:因为未安装apt-utils,所以软件包的设定过程将被推迟
$ sudo apt-get install apt-utils
- Unity Tweak Tool打开提示com.canonical.indicator.appmenu.hud In order to work properly,Unity Tweak Tool recommends you install the necessary packages
$ sudo apt-get install indicator-appmenu
$ sudo apt-get install hud
三、软件安装
- 安装VS Code
$ sudo apt-get install curl
$ curl -L https://github.com/toolboc/vscode/releases/download/1.32.3/code-oss_1.32.3-arm64.deb -o code-oss_1.32.3-arm64.deb
$ sudo dpkg -i code-oss_1.32.3-arm64.deb
- 安装anaconda
$ sudo sh Archiconda3-0.2.3-Linux-aarch64.sh
最后设置是否将路径写入.bashrc,键入yes,提示Thank you for installing Archicinda3!表明安装成功,再执行
$ source ~/.bashrc
- 安装PyCharm
$ sh pycharm.sh
提示:No JRE Found. Please make sure $PYCHARM_JDK, $JDK_HOME, or $JAVA_HOME point to valid JRE installation.时在终端执行
$ sudo apt-get install default-jdk
提示:Failed to load module “canberra-gtk-module”
$ sudo apt-get install libcanberra-gtk-module
为PyCharm创建桌面图标
$ cd /usr/share/applications
$ sudo gedit pycharm.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Pycharm
Icon=/home/academy/software/pycharm-community-2021.3.3/bin/pycharm.png
Exec=/home/academy/software/pycharm-community-2021.3.3/bin/pycharm.sh
MimeType=application/x-py;
Name[en_US]=pycharm
- 安装qt和pyqt5
$ sudo apt-get isntall qttools5-dev-tools
$ sudo apt-get install qt5-default qtcreator -y
安装完成后,在终端执行以下指令,打开Qt designer:
$ designer
接着安装pyqt5
$ sudo apt-get install pyqt5-dev-tools
$ sudo apt-get install python3-pyqt5.*
四、其他问题
- conda创建环境提示NotWritableError:The Current user does not have permissions to a required path
$ sudo chomd 777 -R /home/academy/archiconda3
- conda创建名为python36的虚拟环境,python版本为3.6
$ conda create -n python36 python=3.6
- 安装pytorch, torchvision
$ wget https://nvidia.box.com/shared/static/fjtbno0vpo676a25cgvuqc1wty0fkkg6.whl -O torch-1.10.0-cp36-cp36m-linux_aarch64.whl
$ sudo apt-get install python3-pip libopenblas-base libopenmpi-dev
$ pip3 install Cython
$ pip3 install numpy torch-1.10.0-cp36-cp36m-linux_aarch64.whl
$ sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev
$ pip install torchvision==0.11.1
- Pycharm提示 Error:"Process finished with exit code 132 (interrupted by signal 4: SIGLL)" 或终端运行有关pytorch的python文件提示”非法指令(核心已转储)“
$ pip uninstall numpy
$ pip install numpy==1.13
- Pycharm提示 Error:"Process finished with exit code 137 (interrupted by signal 4: SIGLL)"
- Pycharm配置qt、pyqt5
点击“+”号,分别进行如下设置:
Name:Qt
Program:/usr/lib/aarch64-linux-gpu/qt5/plugins/designer
Arguments:
Working directory: $FileDir$
Name:PyUIC
Program:Python的安装路径
Arguments:-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$.py
Working directory:$FileDir$
在使用qt完成界面设计后,保存为.ui文件,可在Pycharm项目中右击该文件,选择Qt->PyUIC,程序会自动生成同名ui文件的python编译文件,在生成的py文件末尾加上以下代码,再运行,即可实现在qt designer中一样的界面效果(根据qt中选择的不同,可能需要将MainWIndow更换成Widget、Form等)
from PyQt5.QtWidgets import QMainWindow,QApplication
import sys
if __name__ == ‘__main__’:
app = QApplication(sys.argv)
window = QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())
文章同步在我的博客: https://www.isfd.cc/index.php/2022/04/07/jetson-nano配置全记录