Unable to runs scons getting import error

回眸只為那壹抹淺笑 提交于 2019-12-12 14:36:01

问题


I have installed scons 2.3.2 and have python 2.4.

When I run scons, I am seeing the following error:

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

I did a find and found that SCons is present in /usr/lib/scons. I am not sure why scons is not able to pick it up.

What am I missing?


回答1:


The problem (from the bottom of the traceback) is a Syntax error:

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

This is because you are running a version of Python that doesn't support conditional expressions:

Support for this syntax was added in 2.5, see the docs



来源:https://stackoverflow.com/questions/24796186/unable-to-runs-scons-getting-import-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!