ARM, rk3399 深度学习环境及Python版本ncnn编译

一、安装conda
习惯了windows上Anaconda的使用,找了找在ARM平台上也有对应的Conda环境
首先查看硬件环境,在终端输入

uname -a

输出为:
Linux forlinx 4.4.189 #1 SMP Fri Mar 20 09:58:30 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
硬件为aarch64,这个也是ARM的一种
安装包有三种选择
1、
miniconda
2、
Archiconda
3、这个项目依旧在维护
miniforge
下载对应的.sh文件后,输入

bash XXXXXX.sh

根据提醒一路选择 yes或 no即可,安装完成后另起一命令行输入,python,查看环境是否安装成功
设置环境变量可参考

 export PATH=<PATH\TO\ARCHICONDA3>/bin:$PATH

最后在home目录下

source .bashrc

当然,也可以用Linux自带的python环境,我用的开发板是飞凌嵌入式的,里面集成了python3.6
它默认为python2.7,接下来更改默认版本
二、更换默认python版本
以下操作在root用户下

update-alternatives --list python

可能出现报错:update-alternatives:error:no alternatives for python
这个是表示Python的替代版本尚未被 update-alternatives命令识别。想解决这个问题,我们需要更新一下替代列表,将python2.7或python3.6放入其中
得到python路径

whereis python

用得到的路径设置为默认版本

update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1

三、换源
1、备份

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、添加清华源

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

华为源

deb https://repo.huaweicloud.com/ubuntu-ports/ bionic main restricted universe multiverse
deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic main restricted universe multiverse

deb https://repo.huaweicloud.com/ubuntu-ports/ bionic-security main restricted universe multiverse
deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic-security main restricted universe multiverse

deb https://repo.huaweicloud.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic-updates main restricted universe multiverse

deb https://repo.huaweicloud.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic-backports main restricted universe multiverse

## Not recommended
# deb https://repo.huaweicloud.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse
# deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse

更新源列表

sudo apt-get update
sudo apt-get upgrade

四、安装自己所需的包(我这次用的是Linux自带的环境)

sudo apt-get install python3-pip
python3 -m pip install -U pip
pip3 install Cython
pip3 install numpy
pip3 install tqdm
pip3 install requests
pip3 install portalocker
pip3 install opencv-python

五、编译ncnn
1、添加所需工具
ARM, rk3399 深度学习环境及Python版本ncnn编译_第1张图片

sudo apt-get install git
sudo apt-get install cmake

clone完整的源代码

git clone https://github.com/Tencent/ncnn.git

后续跟着官方Readme操作即可传送门

你可能感兴趣的:(python,ubuntu,linux,ncnn,arm)