1# 常见问题<a name="ZH-CN_TOPIC_0000001128470858"></a> 2 3- [hb 安装过程中出现乱码、段错误](#section411894616119) 4- [hb 安装过程中提示"cannot import 'sysconfig' from 'distutils'"](#section629417571626) 5- [hb 安装过程中提示"module 'platform' has no attribute 'linux\_distribution'"](#section10871523332) 6- [hb 安装过程中提示"Could not find a version that satisfies the requirement ohos-build"](#section47351657163213) 7- [Linux编译服务器终端输入不识别的命令时提示“ImportError: No module named apt\_pkg”](#section159891252236) 8 9## hb 安装过程中出现乱码、段错误<a name="section411894616119"></a> 10 11- **现象描述** 12 13 执行“python3 -m pip install --user ohos-build”出现乱码、段错误(segmentation fault)。 14 15 16- **可能原因** 17 18 pip版本过低。 19 20- **解决办法** 21 22 执行如下命令升级pip。 23 24 ``` 25 python3 -m pip install -U pip 26 ``` 27 28 29## hb 安装过程中提示"cannot import 'sysconfig' from 'distutils'"<a name="section629417571626"></a> 30 31- **现象描述** 32 33 执行“python3 -m pip install --user ohos-build”提示"cannot import 'sysconfig' from 'distutils'" 34 35 36- **可能原因** 37 38 缺少distutils模块。 39 40- **解决办法** 41 42 执行如下命令安装。 43 44 ``` 45 sudo apt-get install python3.8-distutils 46 ``` 47 48 49## hb 安装过程中提示"module 'platform' has no attribute 'linux\_distribution'"<a name="section10871523332"></a> 50 51- **现象描述** 52 53 执行“python3 -m pip install --user ohos-build”提示"module 'platform' has no attribute 'linux\_distribution'" 54 55 56- **可能原因** 57 58 python3 pip安装兼容性问题。 59 60- **解决办法** 61 62 执行如下命令重新安装pip。 63 64 ``` 65 sudo apt remove python3-pip 66 curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 67 python get-pip.py 68 ``` 69 70 71## hb 安装过程中提示"Could not find a version that satisfies the requirement ohos-build"<a name="section47351657163213"></a> 72 73- **现象描述** 74 75 执行“python3 -m pip install --user ohos-build”提示"Could not find a version that satisfies the requirement ohos-build" 76 77 78- **可能原因** 79 80 可能是网络环境较差导致的安装失败。 81 82- **解决办法** 83 1. 请检查网络连接是否正常。如果网络有问题,请修复网络问题后重新安装。 84 2. 若网络正常,请尝试指定临时pypi源的方式安装: 85 86 ``` 87 python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ohos-build 88 ``` 89 90 91 92## Linux编译服务器终端输入不识别的命令时提示“ImportError: No module named apt\_pkg”<a name="section159891252236"></a> 93 94- **现象描述** 95 96 Linux编译服务器终端输入不识别的命令时,提示"ImportError: No module named apt\_pkg" 97 98 99- **可能原因** 100 101 python3 apt安装兼容性问题。 102 103- **解决办法** 104 105 执行如下命令重新安装python3-apt。 106 107 ``` 108 sudo apt-get remove python3-apt 109 sudo apt-get install python3-apt 110 ``` 111 112 113