SCons- ***未找到SConstruct文件

时间:2013-06-19 04:17:04

标签: python scons

使用安装的SCons  #cd scons-2.3.0  #python setup.py install

安装后,当我尝试运行scons时,出现以下错误。

scons: * 找不到SConstruct文件。 文件“/usr/local/lib/scons-2.3.0/SCons/Script/Main.py”,第905行,在_main

如何克服这个???

1 个答案:

答案 0 :(得分:11)

使用SCons时有3种方法可以指定SConstruct文件,如下所示:

  • 从项目的根目录执行scons,其中应该有一个SConstruct文件。这是最标准的方式。

  • 从项目的子目录中,根目录中应该有一个SConsctruct文件,使用以下选项之一执行scons(如scons -h所示)告诉它查找SConstruct的目录结构

-u, --up, --search-up
Search up directory tree for SConstruct, build targets at or 
below current directory.

-U
Search up directory tree for SConstruct, build Default() targets 
from local SConscript.
  • 明确指定SConstruct文件的位置,也可以从scons -h
  • 获取
-f FILE, --file=FILE, --makefile=FILE, --sconstruct=FILE
Read FILE as the top-level SConstruct file.

以下是目录/home/notroot/projectDir中的示例项目,具有以下目录结构:

SConstruct
subdir/file.hh
subdir/file.cc

以下是如何使用上述不同选项:

选项1:

从根项目目录执行scons

# cd /home/notroot/projectDir
# scons

选项2:

从项目目录中执行scons并告诉它查找SConstruct的目录层次结构

# cd /home/notroot/projectDir/subdir
# scons -u

选项3:

从项目目录中执行scons并指定SConstruct的路径

# cd /home/notroot/projectDir/subdir
# scons -f /home/notroot/projectDir/SConstruct
相关问题