Jetson nano刷好机之后需要做的准备工作
1 更换镜像源
由于自带的镜像源,在下载东西的时候比较慢,因此更换成国内的镜像源
会然你在安装和下载一些库包
的时候节约很多的时间(参考):
1、先把本地的镜像源文件备份一份
sudo cp /etc/apt/sources.list /etc/apt/sources_back.list
2、把/etc/apt/sources.list
文件中的内容清空,然后替换为国内的清华镜像源
sudo vim /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
3、更新镜像源
sudo apt-get update
2 安装中文输入法
关于如何安装中文输入法参考:这篇博客
如果你安装成功中文输入法之后,在使用的时候没有没有出现候选框
:请参考如下:
3 安装Terminator
之所以安装这个终端,是因为这个终端太好用了,自己体会,如果你已经添加了上面的清华镜像源其实就可以直接下载安装了:
sudo apt-get install terminator
如果没有,则需要添加terminator的下载源(参考):
sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator
3 安装python3库包工具pip3和python2的库包工具pip
- python3
sudo apt-get install python3-pip
- python2
sudo apt-get install python-pip
注意:
如果安装的时候提示:
Unable to locate package python3-pip
,只要sudo apt-get update
更新下镜像源即可!
4 安装jtop方便查看内存、CPU、温度等信息
安装jtop:
sudo -H pip install -U jetson-stats
相信请参考博客
5 把python下载镜像源改成清华镜像源
目的是提高下载速度:
1、到用户目录下
cd ~
2、新建隐藏目录
mkdir .pip
3、新建~/.pip/pip.conf
文件,并在文件中添加如下内容:
vim ~/.pip/pip.conf
添加内容:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
#安装torch
参考Jetson官方文档:https://elinux.org/Jetson_Zoo
# install OpenBLAS and OpenMPI
$ sudo apt-get install libopenblas-base libopenmpi-dev
# Python 2.7 (download pip wheel from above)
$ pip install future torch-1.4.0-cp27-cp27mu-linux_aarch64.whl
# Python 3.6 (download pip wheel from above)
$ sudo apt-get install python3-pip
pip3 install Cython
pip3 install numpy torch-1.6.0-cp36-cp36m-linux_aarch64.whl
注意:
一定先安装依赖:
sudo apt-get install libopenblas-base libopenmpi-dev
,否则你安装好torch,导入的时候就会报错:OSError: libmpi_cxx.so.20: cannot open shared object file: No such file or directory
zhihui@zhihui-desktop:~/tools$ python3
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zhihui/.local/lib/python3.6/site-packages/torch/__init__.py", line 188, in <module>
_load_global_deps()
File "/home/zhihui/.local/lib/python3.6/site-packages/torch/__init__.py", line 141, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libmpi_cxx.so.20: cannot open shared object file: No such file or directory
>>>
6 特殊python库包的安装
6.1 安装pytorch
# install OpenBLAS and OpenMPI
$ sudo apt-get install libopenblas-base libopenmpi-dev
# Python 2.7 (download pip wheel from above)
$ pip install future torch-1.4.0-cp27-cp27mu-linux_aarch64.whl
# Python 3.6 (download pip wheel from above)
$ sudo apt-get install python3-pip
pip3 install Cython
pip3 install numpy torch-1.6.0-cp36-cp36m-linux_aarch64.whl
6.2 安装pillow
安装pillow,直接安装会报错,需要先安装依赖:
1、安装pillow依赖
sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
2、安装pillow
pip3 install pillow
6.3 安装pycuda
6.4 安装tkinter
sudo apt-get install python3-tk