无法运行 scons 出现导入错误 [英] Unable to runs scons getting import error
本文介绍了无法运行 scons 出现导入错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经安装了 scons 2.3.2 和 python 2.4.
I have installed scons 2.3.2 and have python 2.4.
当我运行 scons 时,我看到以下错误:
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
我做了一个发现,发现/usr/lib/scons 中存在 SCons.我不知道为什么 scons 不能把它捡起来.
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.
我错过了什么?
推荐答案
问题(从回溯的底部)是语法错误:
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
这是因为您运行的 Python 版本不支持条件表达式:
This is because you are running a version of Python that doesn't support conditional expressions:
在 2.5 中添加了对此语法的支持,请参阅文档
Support for this syntax was added in 2.5, see the docs
这篇关于无法运行 scons 出现导入错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文