我安装了scons 2.3.2并使用了python 2.4。
当我运行scons时,我看到以下错误:
scons
Import failed. Unable to find SCons files in:
/usr/bin/../engine
/usr/bin/scons-local-2.3.2
/usr/bin/scons-local
/usr/lib/scons-2.3.2
/usr/lib/scons-2.3.2
/usr/local/lib/scons-2.3.2
/usr/lib/python2.4/site-packages/scons-2.3.2
/usr/lib/python2.4/site-packages/scons-2.3.2
/usr/local/lib/python2.4/site-packages/scons-2.3.2
/usr/lib64/scons-2.3.2
/usr/lib/scons
/usr/lib/scons
/usr/local/lib/scons
/usr/lib/python2.4/site-packages/scons
/usr/lib/python2.4/site-packages/scons
/usr/local/lib/python2.4/site-packages/scons
/usr/lib64/scons
Traceback (most recent call last):
File "/usr/bin/scons", line 190, in ?
import SCons.Script
File "/usr/lib/scons/SCons/Script/__init__.py", line 76, in ?
import SCons.Environment
File "/usr/lib/scons/SCons/Environment.py", line 48, in ?
import SCons.Defaults
File "/usr/lib/scons/SCons/Defaults.py", line 52, in ?
import SCons.Tool
File "/usr/lib/scons/SCons/Tool/__init__.py", line 50, in ?
import SCons.Scanner.C
File "/usr/lib/scons/SCons/Scanner/C.py", line 36, in ?
import SCons.cpp
File "/usr/lib/scons/SCons/cpp.py", line 398
p = self.stack[-1] if self.stack else self.default_table
^
SyntaxError: invalid syntax
我做了一个发现,发现SCons存在于/ usr / lib / scons中。我不确定为什么scons无法接收它。
我错过了什么?
答案 0 :(得分:6)
问题(来自追踪的底部)是语法错误:
p = self.stack[-1] if self.stack else self.default_table
^
SyntaxError: invalid syntax
这是因为您运行的是不支持条件表达式的Python版本:
2.5中添加了对此语法的支持,请参阅the docs