问题描述
-
ubuntu 20.04
-
RT-Thread userapps https://github.com/RT-Thread/userapps
-
使用
scons
编译 rt-smart 的 userapps 时,一直报ModuleNotFoundError: No module named 'lib2to3'
的错误
rtt@ubuntu:~/smart/userapps$ scons
scons: Reading SConscript files ...
ModuleNotFoundError: No module named 'lib2to3':
File "/home/rtt/smart/userapps/SConstruct", line 57:
BuildDir(os.path.join(cwd, 'apps'))
File "/home/rtt/smart/userapps/SConstruct", line 24:
BuildApplication(item, path + '/SConscript', usr_root = '.')
File "/home/rtt/smart/userapps/tools/building.py", line 511:
env = BuildEnv()
File "/home/rtt/smart/userapps/tools/building.py", line 125:
from install import TOOL_INSTALL
File "/home/rtt/smart/userapps/tools/install.py", line 143:
from lib2to3.fixes.fix_apply import FixApply
- 尝试清理工程,重新 git 拉取代码,发现依旧报错,由于这个 git 仓库之前是正常编译的,所以怀疑【编译环境】有差异
解决方法
-
遇到找不到软件包,就尝试在 ubuntu 上安装一下软件包,让我诧异的是,ubuntu 上果然有这个软件包
-
安装方法:
$ sudo apt install 2to3
-
安装成功了,并且可以正常的使用
scons
编译了,不过这个2to3
lib 确实没有遇到过
小结
- 编译时,如果遇到 xxx 找不到,ubuntu 上 可以尝试使用
apt-cache search xxx
搜索一下依赖的组件