Linux安装DevEco Device Tool
1. 安装Python,默认已经安装;
2. 安装VSCode,默认已经安装,如果版本低,可以更新到最新版本;
3. 在https://device.harmonyos.com/cn/develop/ide#download下载DevEco Device Tool 4.0 Release,选择Linux版本,下载devicetool-linux-tool-4.0.0.400.zip,解压缩后是一个sh文件,运行安装;
4. 运行VSCode,点左侧的Extensions,可以看到DevEco Device Tool已经安装到Visual Studio Code中了,成为了插件;
点击左侧的三角形,就可以进入DevEco Device Tool界面;
5. 到https://nodejs.org/en下载最新版本,在用户目录下新建一个HarmonyTools文件夹,将下载的node-v20.11.1-linux-x64.tar.xz复制到该文件夹下面,再解压,执行命令gedit ~/.bashrc,在最后一行插入
export NODE_HOME=~/HarmonyTools/node-v20.11.1-linux-x64
export PATH=$NODE_HOME/bin:$PATH
source ~/.bashrc生效,输入
node -v
npm -v
查看是否安装成功;
6. 输入以下命令将npm源配置为国内镜像:
npm config set registry https://repo.huaweicloud.com/repository/npm/
再输入下面的命令安装HPM:
npm install -g @ohos/hpm-cli@1.4.2
6. 执行下列命令查看是否安装成功:
hpm -V
hpm --version
7. 安装安装jinjia:
pip3 install jinja2
8. 安装scons:
sudo apt-get install scons
查看是否安装成功:
9. 安装pycryptodome:
python3 -m pip install pycryptodome
10. 安装ecdsa:
python3 -m pip install ecdsa
11. 安装安装kconfiglib:
python3 -m pip install kconfiglib
12. 安装setuptools,默认已安装;
13. 安装ohos-build:
python3 -m pip install --user ohos-build
14. 设置环境变量:
python3 -m pip install --user ohos-build
source ~/.bashrc生效;
15. 安装hb:
python3 -m pip install --user ohos-build==0.4.3
16. 从https://link.zhihu.com/?target=https%3A//repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz下载gn到HarmonyTools,解压缩,添加环境变量:
export PATH=~/HarmonyTools/gn-linux-x86-1717:$PATH
17. 从https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar下载nijiaHarmonyTools,解压缩,添加环境变量:
export PATH=~/HarmonyTools/ninja.1.9.0/ninja:$PATH
18. 从https://link.zhihu.com/?target=https%3A//repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar下载LLVM到HarmonyTools,解压缩,添加环境变量:
export PATH=~/HarmonyTools/llvm/bin:$PATH
19. 从https://link.zhihu.com/?target=https%3A//repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz下载gcc_riscv32到HarmonyTools,解压缩,添加环境变量:
export PATH=~/HarmonyTools/gcc_riscv32-linux-7.3.0/gcc_riscv32/bin:$PATH