尝试设置简单的Sconstruct'Hello World'脚本时遇到问题

时间:2019-02-24 04:50:09

标签: python python-3.x scons

现在,在有人遇到我之前,我已经看过这个问题了。我知道我不是唯一一个遇到此问题的人,但是,我尝试按照人们的建议进行修复,但没有成功。请帮忙。

我遇到了错误:

Index Error: List index out of range

我已经尝试了一切,但没有任何效果。对不起,我是新来的。

问题本身在这里:

C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Sconstruct>s
cons
scons: Reading SConscript files ...
IndexError: list index out of range:
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Scon
struct\SConstruct.py", line 1:
    SConstruct: Program('HelloWorld.c')
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Scri
pt\SConscript.py", line 665:
    env = self.factory()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Scri
pt\SConscript.py", line 645:
    default_env = SCons.Defaults.DefaultEnvironment()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Defa
ults.py", line 88:
    _default_env = SCons.Environment.Environment(*args, **kw)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Envi
ronment.py", line 982:
    apply_tools(self, tools, toolpath)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Envi
ronment.py", line 107:
    env.Tool(tool)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Envi
ronment.py", line 1789:
    tool(self)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\__init__.py", line 296:
    self.generate(env, *args, **kw)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\default.py", line 40:
    for t in SCons.Tool.tool_list(env['PLATFORM'], env):
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\__init__.py", line 1266:
    c_compiler = FindTool(c_compilers, env) or c_compilers[0]
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\__init__.py", line 1169:
    if t.exists(env):
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\msvc.py", line 292:
    return msvc_exists(env)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\MSCommon\vc.py", line 759:
    vcs = cached_get_installed_vcs(env)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\MSCommon\vc.py", line 524:
    ret = get_installed_vcs(env)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\MSCommon\vc.py", line 535:
    VC_DIR = find_vc_pdir(ver)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\MSCommon\vc.py", line 344:
    comps = find_vc_pdir_vswhere(msvc_version)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\scons\SCons\Tool
\MSCommon\vc.py", line 306:
    vc_pdir = os.path.join(vsdir[0], 'VC')

谢谢。

编辑:感谢Faruk13,我对此进行了编辑。反正这就是Partho63的意思吗?

编辑2:这是您请求的文件。抱歉。

https://www.dropbox.com/s/u3e5ojuh9b5zyge/Sconstruct%20Files.zip?dl=0

编辑3:

我发现了问题。显然,Visual C在我第一次安装时未正确安装。重新安装后,它可以工作了。谢谢大家的帮助,如果我让我的新举行为使你们烦恼,则对不起。谢谢您的帮助。

2 个答案:

答案 0 :(得分:0)

需要正确安装Visual C,Scons才能正常构建或工作。

答案 1 :(得分:0)

此特定错误消息归因于SCons 3.0.4中引入的错误。即使您没有计划使用MSVC编译器,它也会在未安装MSVC编译器的Windows环境中影响显示。

此拉取请求https://github.com/SCons/scons/pull/3288已修复。在撰写本文时,SCons 3.0.4是最新发布的版本,因此您将需要使用master分支或返回到先前的版本。