【问题标题】:SCons- *** No SConstruct file foundSCons- *** 未找到 SConstruct 文件
【发布时间】:2013-06-19 04:17:03
【问题描述】:

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

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

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

如何克服这个???

【问题讨论】:

  • 这可能会有所帮助:stackoverflow.com/questions/8097442/…
  • 如何在scons中搜索SConstruct文件
  • @user2439278 可能有点晚了,但你能接受下面的答案(如果有帮助的话)吗?这会将问题标记为已解决并帮助其他用户。

标签: python scons


【解决方案1】:

在使用SCons时指定SConstruct文件有3种方式,如下:

  • 从项目的根目录执行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

【讨论】:

  • 能否请您举例说明一下。我已经在 /usr/local/lib/scons-2.3.0/SCons/ 中创建并存储了 SConstruct.py。
  • 我是新手。请帮我解决这个问题
  • @user2439278 好的,我会用一个例子来更新答案。但是当我提到一个项目时,我指的是源代码项目,而不是 SCons 安装项目。
猜你喜欢
  • 1970-01-01
  • 2010-11-28
  • 1970-01-01
  • 2021-06-05
  • 1970-01-01
  • 2014-01-15
  • 2018-10-20
  • 2015-04-12
  • 1970-01-01
相关资源
最近更新 更多