在之前版本中,XJ3浮点转换工具链仅仅支持Centos 7原生环境,在Ubuntu等开发环境中,必须通过Docker方式进行使用,一定程度上加大了安装和上手的复杂程度。
为了满足社区用户的使用需求,在最新发布的1.1.16版本XJ3浮点转换工具链中,我们新增了对Ubuntu 16.04和Ubutun 18.04环境原生支持,并提供了非常简单易用的安装脚本来引导客户进行使用。
|-- horizon_x3_tc_1.1.16| |--deps_version.conf| |--doc| |--install| |--packages| |--runtime| |--install_ubuntu_deps.sh| |--install.sh| |--samples
Ubuntu环境下安装涉及到install_ubuntu_deps.sh和install.sh两个安装步骤,在执行install.sh脚本之前,务必install_ubuntu_deps.sh脚本内相关步骤都被正确的安装。
由于install_ubuntu_deps.sh涉及到一些系统级别的依赖组件的安装了,为了避免对客户系统造成影响,在install_ubuntu_deps.sh中我们更多是给出安装建议指令,基于这些指令用户可以逐步在Ubuntu环境中完成依赖的安装。
下面逐步对install_ubuntu_deps.sh进行逐步讲解,从而理解脚本对系统的一些操作和影响;
1. 将Terminal环境切换为bash:现在的Ubuntu版本默认sh都是使用的dash,使用起来较为别扭;同时由于XJ3浮点转换工具链中sample大量使用了shell脚本,并且shell脚本撰写过程中是参考bash规范进行实现,不做切换将会导致部分脚本执行失败。
如果install_ubuntu_deps.sh检测到Terminal环境还是dash,将会做如下提示。用户需要自己手动执行sudo dpkg-reconfigure dash来进行切换。
注意该命令需要sudo权限。另外该命令会有提示选择界面,务必选择NO才可以正确完成切换。
work@ubuntu:~/Downloads/horizon_x3_tc_1.1.16$ sh install/install_ubuntu_deps.shplease change sh to bashthis can be changed via command 'sudo dpkg-reconfigure dash' and select NO
2. 系统工具的安装:包括lsb-core,graphviz:在Ubuntu环境安装这两个包需要sudo权限,如果检测到这两个库暂时未安装,将会给出如下的安装提示,用户需手动完成安装;
注意该命令需要sudo权限。
'lsb-core' not installed please install 'lsb-core' manually via command:sudo apt-get install lsb-core -y 'graphviz' not installedplease install 'graphviz' manually via command:sudo apt-get install graphviz -y
3. Python环境升级:XJ3浮点转换工具链仅仅支持Python3.6的环境,并且配套的libpython3.6也正确被安装。
这个条件对Ubuntu 18.04还好,它默认安装了Python 3.6.9,libpyhon 3.6也已经安装;但是对于Ubuntu 16.04就比较糟糕,官方源暂时未提供python3.6包,需要手动进行安装源,安装提示如下:
'python3.6' not installedplease install 'python3.6' manually via command:sudo apt-get install python3.6 -yif apt-get can not find python3.6, please consider add additional source repo and update apt-get using command:sudo apt-get install software-properties-common -ysudo add-apt-repository ppa:deadsnakes/ppasudo apt-get update
完成上面的python3.6以后,还需要手动切换系统默认的python版本。注意该切换过程需要sudo命令,存在操作风险,请务必小心操作
python3_version 3.6.9, version incorrectplease make sure to use python 3.6 version as default python3 commandThis can be set via command:sudo mv /usr/bin/python3 /usr/bin/python3.baksudo ln -s /usr/bin/python3.6 /usr/bin/python3 WARNING!!!: If the default python version is changed,it could cause failure to open UI & terminals.Virtual environment is recommended in this caseIf you are not certain regarding the result, please consultHorizon support team for more detail
对于上面WARNING!!!请注意,在Ubuntu 16.04环境下,手动切换python版本,可能会导致Ubuntu Terminal命令行环境无法打开,建议安装之前先阅读https://blog.csdn.net/u010420283/article/details/89222132,了解风险并在出现问题以后基于文档方案进行恢复。
4. Python Pip环境安装和升级:python3-pip需要被安装,如果检测到未安装,会给出如下提示:
'python3-pip' not installedplease make sure python3 is set to 'python3.6' then install 'python3-pip' manually via command:sudo apt-get install python3-pip -y
Ubuntu默认的pip版本9.0.1太老,请务必根据提示,主动升级到pip==20.1.1,否则会导致其他环节的安装失败。
pip3 python version pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6), version correct'pip' installed correct.pip version too low. Do you wish to upgrade pip to the lastest version[yes|no]?
输入yes自动完成python的package的升级;
5. 提前安装python package包:easydict,pycocotools,absl-py,zmq
特别注意pycocotools,由于pycocotools本身库的原因,安装时间较长,也存在一定的失败情况,暂时开源社区也没有提供特别好的办法。
因此在这个环节,如果安装pycocotools失败,可以直接选择跳过,他仅仅影响coco数据测评,主要是sample/yolo的示例使用会受到影响;后续再单独进行安装。
ATTENTION: This pycocotools install process could take a very long time...This install process is only needed by some test cases, e.g. yolov2 and yolov3And it can be installed manually via command:pip3 install pycocotools -i https://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com --extra-index-url=http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com --user -U======================================================Do you wish to install pycocotools[yes|no]?
可以先yes尝试进行安装,如果安装时间过长和安装失败,可以重新运行该脚本,选择no跳过安装。
6. arm-gcc-linaro交叉编译环境的安装:根据提示手动下载交叉编译工具包,并解压后的bin目录设置到LINARO_GCC_ROOT环境变量中。
environment variable 'LINARO_GCC_ROOT' not setIf gcc 6.5.0 is not installed, please download it via link:http://releases.linaro.org/components/toolchain/binaries/6.5-2018.12/aarch64-linux-gnu/gcc-linaro-6.5.0-2018.12-x86_64_aarch64-linux-gnu.tar.xzIf gcc 6.5.0 is already installedplease set gcc path to LINARO_GCC_ROOT in ~/.bashrc or other proper placesthen restart terminal to proceed
7. cmake 3.14.5安装
在完成正确完成install_ubuntu_deps.sh安装以后,install.sh安装流程将会完成自动化。