我尝试使用scons为python脚本构建一个可执行文件,但是没有以下跟踪:
C:\WORKAREA\study>C:\Python26\Scripts\scons
scons: Reading SConscript files ...
scons: warning: No installed VCs
File "C:\WORKAREA\study\SConstruct", line 1, in <module>
scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "C:\WORKAREA\study\SConstruct", line 1, in <module>
scons: done reading SConscript files.
scons: Building targets ...
link /nologo /OUT:fibo.exe fibo.py
'link' is not recognized as an internal or external command,
operable program or batch file.
scons: *** [fibo.exe] Error 1
scons: building terminated because of errors.
似乎 link / nologo / OUT 是一切都崩溃的地方。任何人都可以帮我这个吗?
答案 0 :(得分:3)
您正在尝试从.py文件构建.exe文件吗?在这种情况下,您不需要VC ++编译器,您将需要一个像py2exe这样的工具。如果要将SCons用作构建系统,则需要为py2exe.exe创建SCons构建器。有点像:
env = Environment()
def py2exe_action(target, source, env):
# execute py2exe <source> <output> here
return 0
env['BUILDERS']['Py2Exe'] = env.Builder(action = py2exe_action)
env.Default(env.Py2Exe(target = 'out_exe_file.exe', source = 'in_python_file.py'))