ubuntu-20.04.3 hb 安装失败

举报
Yuchuan 发表于 2022/03/12 15:35:01 2022/03/12
【摘要】 hb
master3@master3-pc:~$ hb -h
Traceback (most recent call last):
  File "/home/master3/.local/bin/hb", line 8, in <module>
    sys.exit(main())
  File "/home/master3/.local/lib/python3.8/site-packages/hb/__main__.py", line 49, in main
    topdir = find_top()
  File "/home/master3/.local/lib/python3.8/site-packages/hb/__main__.py", line 37, in find_top
    raise Exception("Please call hb utilities inside source root directory")
Exception: Please call hb utilities inside source root directory
master3@master3-pc:~$
master3@master3-pc:~$

解决方案:

首先,安装之后还需要在环境变量中配置才会生效;

其次,可能和hb的版本有关,你可以先当前的hb先卸载,然后在源码根目录下重新安装

# 首先需要cd到源码根目录
pip3 uninstall ohos-build
pip3 install build/lite

master3@master3-pc:~$
master3@master3-pc:~$ pip3 uninstall ohos-build
Found existing installation: ohos-build 0.4.6
Uninstalling ohos-build-0.4.6:
  Would remove:
    /home/master3/.local/bin/hb
    /home/master3/.local/lib/python3.8/site-packages/hb/*
    /home/master3/.local/lib/python3.8/site-packages/ohos_build-0.4.6.dist-info/*
Proceed (Y/n)? y
  Successfully uninstalled ohos-build-0.4.6
master3@master3-pc:~$ ll

# 首先需要cd到源码根目录

master3@master3-pc:~/MasterData/HarmonyOSData/code-v3.1-Beta/OpenHarmony$ pip3 install build/lite
Defaulting to user installation because normal site-packages is not writeable
Processing ./build/lite
  Preparing metadata (setup.py) ... done
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from ohos-build==0.4.4) (5.3.1)
Requirement already satisfied: kconfiglib>=14.1.0 in /home/master3/.local/lib/python3.8/site-packages (from ohos-build==0.4.4) (14.1.0)
Requirement already satisfied: prompt_toolkit==1.0.14 in /home/master3/.local/lib/python3.8/site-packages (from ohos-build==0.4.4) (1.0.14)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from ohos-build==0.4.4) (2.22.0)
Requirement already satisfied: six>=1.9.0 in /home/master3/.local/lib/python3.8/site-packages (from prompt_toolkit==1.0.14->ohos-build==0.4.4) (1.16.0)
Requirement already satisfied: wcwidth in /home/master3/.local/lib/python3.8/site-packages (from prompt_toolkit==1.0.14->ohos-build==0.4.4) (0.2.5)
Building wheels for collected packages: ohos-build
  Building wheel for ohos-build (setup.py) ... done
  Created wheel for ohos-build: filename=ohos_build-0.4.4-py3-none-any.whl size=9293 sha256=dd56d53cfeb4aa4bd4d57f15593214e7dbce97992e38f977122656f6194107df
  Stored in directory: /tmp/pip-ephem-wheel-cache-ohmga4kf/wheels/51/7b/94/cb5c6fe8e5307ac37ee40ca93b8f84dea785ea920c833107f4
Successfully built ohos-build
Installing collected packages: ohos-build
Successfully installed ohos-build-0.4.4
master3@master3-pc:~/MasterData/HarmonyOSData/code-v3.1-Beta/OpenHarmony$

master3@master3-pc:~/MasterData/HarmonyOSData/code-v3.1-Beta/OpenHarmony$ hb -h
usage: hb [-h] [-v] {build,set,env,clean} ...

OHOS Build System version 0.4.4

positional arguments:
  {build,set,env,clean}
    build               Build source code
    set                 OHOS build settings
    env                 Show OHOS build env
    clean               Clean output

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
master3@master3-pc:~/MasterData/HarmonyOSData/code-v3.1-Beta/OpenHarmony$
master3@master3-pc:~/MasterData/HarmonyOSData/code-v3.1-Beta/OpenHarmony$

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。