Open dissor opened 3 years ago
看看python的版本,需要python3
root@iZbp1el5vpkcpl91mo92orZ:~# python3 --version Python 3.6.9 root@iZbp1el5vpkcpl91mo92orZ:~# python --version Python 2.7.17
python2和3都有的
在awtk目录进行scons没有问题,在awtk-linux-fb目录执行文档中的步骤会报错
在SConstruct里加下面这行代码,看看python的版本
print(sys.executable)
exit(0)
这句代码要加在第几行,我不太熟悉这个语法,可以指点下吗
root@iZbp1el5vpkcpl91mo92orZ:~/awtk-linux-fb# vim SConstruct root@iZbp1el5vpkcpl91mo92orZ:~/awtk-linux-fb# scons APP=../user_apps/HelloDesigner-Demo scons: Reading SConscript files ... NameError: name 'sys' is not defined: File "/root/awtk-linux-fb/SConstruct", line 71: print(sys.executable)
文件最前面加:
import sys
root@iZbp1el5vpkcpl91mo92orZ:~/awtk-linux-fb# scons APP=../user_apps/HelloDesigner-Demo scons: Reading SConscript files ... /usr/bin/python root@iZbp1el5vpkcpl91mo92orZ:~/awtk-linux-fb# /usr/bin/python --version Python 2.7.17 谢谢,这个是python2
怎么把它重定向到python3呢
这样试试:
先卸载python2的scons
pip uninstall scons
设置别名(最好同时放到~/.bash_profile 文件中,免得每次都要设置)
alias python=python3
alias pip=pip3
重新安装scons
pip install scons
:~/awtk-linux-fb# scons scons: Reading SConscript files ... /usr/bin/python3 TypeError: File /root/awtk-linux-fb/build/bin found where directory expected.: File "/root/awtk-linux-fb/SConstruct", line 75: SConscript(SConscriptFiles) File "/usr/local/lib/python3.6/dist-packages/SCons/Script/SConscript.py", line 661: return method(*args, kw) File "/usr/local/lib/python3.6/dist-packages/SCons/Script/SConscript.py", line 598: return _SConscript(self.fs, *files, *subst_kw) File "/usr/local/lib/python3.6/dist-packages/SCons/Script/SConscript.py", line 287: exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals) File "/root/awtk-linux-fb/build/var/awtk/src/SConscript", line 125: env.SharedLibrary(os.path.join(BIN_DIR, 'tkc'), [], LIBS=TKC_DEPS_LIBS, LINKFLAGS=TKC_LINKFLAGS); File "/usr/local/lib/python3.6/dist-packages/SCons/Environment.py", line 255: return MethodWrapper.call(self, target, source, args, kw) File "/usr/local/lib/python3.6/dist-packages/SCons/Environment.py", line 219: return self.method(nargs, kwargs) File "/usr/local/lib/python3.6/dist-packages/SCons/Builder.py", line 653: return self._execute(env, target, source, OverrideWarner(kw), ekw) File "/usr/local/lib/python3.6/dist-packages/SCons/Builder.py", line 563: tlist, slist = self._create_nodes(env, target, source) File "/usr/local/lib/python3.6/dist-packages/SCons/Builder.py", line 508: tlist = env.arg2nodes(target, target_factory, target=target, source=source) File "/usr/local/lib/python3.6/dist-packages/SCons/Environment.py", line 488: v = node_factory(self.subst(v, kw)) File "/usr/local/lib/python3.6/dist-packages/SCons/Node/FS.py", line 1404: return self._lookup(name, directory, File, create) File "/usr/local/lib/python3.6/dist-packages/SCons/Node/FS.py", line 1383: return root._lookup_abs(p, fsclass, create) File "/usr/local/lib/python3.6/dist-packages/SCons/Node/FS.py", line 2403: dir_node = self._lookup_abs(dir_name, Dir) File "/usr/local/lib/python3.6/dist-packages/SCons/Node/FS.py", line 2408: result.diskcheck_match() File "/usr/local/lib/python3.6/dist-packages/SCons/Node/FS.py", line 1615: "File %s found where directory expected.") File "/usr/local/lib/python3.6/dist-packages/SCons/Node/FS.py", line 393: return self.func(args, **kw) File "/usr/local/lib/python3.6/dist-packages/SCons/Node/FS.py", line 414: raise TypeError(errorfmt % node.get_abspath()) root@iZbp1el5vpkcpl91mo92orZ:~/awtk-linux-fb# /usr/bin/python3 --version Python 3.6.9 root@iZbp1el5vpkcpl91mo92orZ:~/awtk-linux-fb#
好像问题依旧
我这里没问题,没法帮你。
https://blog.csdn.net/p1279030826/article/details/111464816 我是手工安装了python3.8,参照这个文章,scons改成了4.1.0 打印出来也是3.8了,但还是报上面的错误,感觉是py脚本有问题啊。
能帮忙看看吗?
scons: Reading SConscript files ...
TypeError: File /home/develop/gowork/src/github.com/zlgopen/awtk-linux-fb/build/bin found where directory expected.:
File "/home/develop/gowork/src/github.com/zlgopen/awtk-linux-fb/SConstruct", line 75:
SConscript(SConscriptFiles)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Script/SConscript.py", line 654:
return method(*args, **kw)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Script/SConscript.py", line 591:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Script/SConscript.py", line 280:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/home/develop/gowork/src/github.com/zlgopen/awtk-linux-fb/build/var/awtk/src/SConscript", line 127:
env.SharedLibrary(os.path.join(BIN_DIR, 'tkc'), [], LIBS=TKC_DEPS_LIBS, LINKFLAGS=TKC_LINKFLAGS);
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Environment.py", line 238:
return super().__call__(target, source, *args, **kw)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Util.py", line 658:
return self.method(*nargs, **kwargs)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Builder.py", line 650:
return self._execute(env, target, source, OverrideWarner(kw), ekw)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Builder.py", line 560:
tlist, slist = self._create_nodes(env, target, source)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Builder.py", line 505:
tlist = env.arg2nodes(target, target_factory, target=target, source=source)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Environment.py", line 474:
v = node_factory(self.subst(v, **kw))
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Node/FS.py", line 1399:
return self._lookup(name, directory, File, create)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Node/FS.py", line 1378:
return root._lookup_abs(p, fsclass, create)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Node/FS.py", line 2398:
dir_node = self._lookup_abs(dir_name, Dir)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Node/FS.py", line 2403:
result.diskcheck_match()
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Node/FS.py", line 1609:
diskcheck_match(self, self.isfile,
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Node/FS.py", line 388:
return self.func(*args, **kw)
File "/usr/local/python3.8/lib/python3.8/site-packages/SCons-4.1.0-py3.8.egg/SCons/Node/FS.py", line 409:
raise TypeError(errorfmt % node.get_abspath())
重装了个deepin20,用update-alternatives切换到python3.7 按上面方面,安装scons4.1.0 然后就可以运行了。 折腾一天,浪费时间了。
辛苦了。
我遇到同样的问题。我是开始可以编译的,然后,就不行了,报跟你几乎一样的错误。
@WeSrc-Yin 我现在不玩这个了,按我上面说的,安装个干净的系统,肯定没问题的。
/awtk-linux-fb# scons scons: Reading SConscript files ... TypeError: File /root/awtk-linux-fb/build/bin found where directory expected.: File "/root/awtk-linux-fb/SConstruct", line 71: SConscript(SConscriptFiles) File "/usr/lib/scons/SCons/Script/SConscript.py", line 614: return method(*args, kw) File "/usr/lib/scons/SCons/Script/SConscript.py", line 551: return _SConscript(self.fs, *files, *subst_kw) File "/usr/lib/scons/SCons/Script/SConscript.py", line 256: call_stack[-1].globals) File "/root/awtk-linux-fb/build/var/awtk/src/SConscript", line 125: env.SharedLibrary(os.path.join(BIN_DIR, 'tkc'), [], LIBS=TKC_DEPS_LIBS, LINKFLAGS=TKC_LINKFLAGS); File "/usr/lib/scons/SCons/Environment.py", line 260: return MethodWrapper.call(self, target, source, args, kw) File "/usr/lib/scons/SCons/Environment.py", line 224: return self.method(nargs, kwargs) File "/usr/lib/scons/SCons/Builder.py", line 645: return self._execute(env, target, source, OverrideWarner(kw), ekw) File "/usr/lib/scons/SCons/Builder.py", line 564: tlist, slist = self._create_nodes(env, target, source) File "/usr/lib/scons/SCons/Builder.py", line 511: tlist = env.arg2nodes(target, target_factory, target=target, source=source) File "/usr/lib/scons/SCons/Environment.py", line 483: v = node_factory(self.subst(v, kw)) File "/usr/lib/scons/SCons/Node/FS.py", line 1356: return self._lookup(name, directory, File, create) File "/usr/lib/scons/SCons/Node/FS.py", line 1335: return root._lookup_abs(p, fsclass, create) File "/usr/lib/scons/SCons/Node/FS.py", line 2367: dir_node = self._lookup_abs(dir_name, Dir) File "/usr/lib/scons/SCons/Node/FS.py", line 2372: result.diskcheck_match() File "/usr/lib/scons/SCons/Node/FS.py", line 1581: "File %s found where directory expected.") File "/usr/lib/scons/SCons/Node/FS.py", line 377: return self.func(args, **kw) File "/usr/lib/scons/SCons/Node/FS.py", line 398: raise TypeError(errorfmt % node.get_abspath())