概述
1第一步
更改镜像源,不更改镜像源后面就会报错。
sudo vi /etc/apt/sources.list
复制下面一段,替换原来的镜像网址
deb http://wiki.t-firefly.com/firefly-rk3399-repo bionic main
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic universe
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic universe
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates universe
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-security universe
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-security universe
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-security multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic-security multiverse
然后更新源
sudo apt-get update
2.1 安装python3.7
sudo apt update #检查可更新文件
sudo apt install software-properties-common #安装可添加源的工具
sudo add-apt-repository ppa:deadsnakes/ppa #添加源,否则会无法找到python3.7-dev软件包
sudo apt install python3.7-dev #安装python3.7
2.2 1.2修改python默认为python3.7
为了因为C++调用python时,默认是调用python2.7,这导致很多python3.7的语法报错。所以需要更改python默认软连接
查看路径python,python3.7路径
which python python3.7
/usr/bin/python
/usr/bin/python3.7
sudo rm /usr/bin/python
sudo rm /usr/bin/python3
创建python3.软连接到python&Python3
sudo ln -s /usr/bin/python3.7 /usr/bin/python
sudo ln -s /usr/bin/python3.7 /usr/bin/python3
3 sudo apt-get update 更新包和安装依赖包
出现报错: No module named 'apt_pkg’
进行下面操作
sudo vi /usr/bin/apt-add-repository
#! /usr/bin/python3.6
cd /usr/lib/python3/dist-packages
sudo cp apt_pkg.cpython-36m-aarch64-linux-gnu.so apt_pkg.so
然后 sudo apt-get update
接下来安装依赖的包
pip3 install Cython
sudo apt-get install gcc python3-dev
sudo apt-get install libhdf5-dev
sudo apt-get install cmake gcc g++ libprotobuf-dev protobuf-compiler libgfortran5-dbg libopenblas-dev gfortran libprotoc-dev
4 安装下面的包
pip3 install wheel opencv-python4.6.0.66 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy1.20.1
sudo apt-get install libhdf5-dev
rknn_toolkit-1.7.1-cp37-cp37m-linux_aarch64.whl放到目录下面,提前安装,不依赖包,编译的速度太慢,而且容易报错,这样大幅度提高了安装效率。
pip3 install --no-deps -i https://pypi.tuna.tsinghua.edu.cn/simple rknn_toolkit-1.7.1-cp37-cp37m-linux_aarch64.whl
pip3 install h5py2.8.0 -i https://pypi.tuna.tsinghua.edu.cn/simple #安装h5py包,编译完成即可进行下一步
pip3 install scipy1.7.0 -i https://pypi.tuna.tsinghua.edu.cn/simple #安装scipy包,编译完成即可进行下一步
这时候提示缺少了这些包,一一去安装上。
ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
rknn-toolkit 1.7.1 requires dill0.2.8.2, which is not installed.
rknn-toolkit 1.7.1 requires flatbuffers1.10, which is not installed.
rknn-toolkit 1.7.1 requires lmdb0.93, which is not installed.
rknn-toolkit 1.7.1 requires networkx1.11, which is not installed.
rknn-toolkit 1.7.1 requires onnx-tf1.2.1, which is not installed.
rknn-toolkit 1.7.1 requires ply3.11, which is not installed.
rknn-toolkit 1.7.1 requires psutil5.6.2, which is not installed.
rknn-toolkit 1.7.1 requires ruamel.yaml0.15.81, which is not installed.
rknn-toolkit 1.7.1 requires sklearn0.0, which is not installed.
rknn-toolkit 1.7.1 requires flask1.0.2, but you have flask 2.2.2 which is incompatible.
rknn-toolkit 1.7.1 requires numpy1.16.3, but you have numpy 1.20.0 which is incompatible.
rknn-toolkit 1.7.1 requires Pillow5.3.0, but you have pillow 5.1.0 which is incompatible.
rknn-toolkit 1.7.1 requires protobuf3.11.2, but you have protobuf 4.21.5 which is incompatible.
rknn-toolkit 1.7.1 requires requests2.22.0, but you have requests 2.18.4 which is incompatible.
安装缺少的包:
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple dill0.2.8.2 flatbuffers1.10 lmdb0.93 networkx1.11 onnx-tf1.2.1 ply3.11 psutil5.6.2 ruamel.yaml0.15.81 sklearn0.0 protobuf3.11.2 onnx==1.6.0
将 下载好的将下载好的tensorflow-1.14.0-cp37-none-linux_aarch64.whl 放置目录下
然后安装 pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-1.14.0-cp37-none-linux_aarch64.whl
5 更新rknn驱动:sudo apt install firefly-3399pronpu-driver
6 运行tensorflow的案例程序报错,将"from tensorflow.contrib import cloud"去掉:
ImportError: cannot import name ‘cloud’ from ‘tensorflow.contrib’ (/home/firefly/.local/lib/python3.7/site-packages/tensorflow/contrib/init.py)
E Only support ntb mode on ARM64 platform. But can not find device with ntb mode.
E Catch exception when init runtime!
E Traceback (most recent call last):
E File “rknn/api/rknn_base.py”, line 868, in rknn.api.rknn_base.RKNNBase.init_runtime
E File “rknn/api/rknn_runtime.py”, line 171, in rknn.api.rknn_runtime.RKNNRuntime.init
E File “rknn/api/rknn_platform_utils.py”, line 307, in rknn.api.rknn_platform_utils.start_ntp_or_adb
E Exception: Init runtime environment failed!
E Please feedback the detailed log file <log_feedback_to_the_rknn_toolkit_dev_team.log> to the RKNN Toolkit development team.
E You can also check github issues: https://github.com/rockchip-linux/rknn-toolkit/issues
7 参考的博客
6.1 https://blog.csdn.net/Lxbbdxg/article/details/124451477
6.2 https://blog.csdn.net/HTS514286/article/details/123644488
最后
以上就是甜美月饼为你收集整理的在Firefly AIO-3399ProC搭建rknn环境See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade tonewer versions of the distribution.deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricteddeb-src http://mirrors.aliyun.com/ubuntu-port的全部内容,希望文章能够帮你解决在Firefly AIO-3399ProC搭建rknn环境See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade tonewer versions of the distribution.deb-src http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricteddeb-src http://mirrors.aliyun.com/ubuntu-port所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复