编程语言
首页 > 编程语言> > python – 无法运行scons获取导入错误

python – 无法运行scons获取导入错误

作者:互联网

我已经安装了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无法接收它.

我错过了什么?

解决方法:

问题(从追踪的底部)是语法错误:

    p = self.stack[-1] if self.stack else self.default_table
                        ^
SyntaxError: invalid syntax

这是因为您运行的是不支持条件表达式的Python版本:

2.5中添加了对此语法的支持,请参阅the docs

标签:scons,python
来源: https://codeday.me/bug/20190825/1714539.html