windows中的SCON问题

2024-06-16 11:00:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用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是一切都崩溃的地方。有人能帮我吗?在


Tags: ofnoinlinelinkfilessconsfile
1条回答
网友
1楼 · 发布于 2024-06-16 11:00:19

你想从一个.py文件生成一个.exe文件,对吗?在这种情况下,您不需要VC++编译器,而是需要一个像py2exe这样的工具。如果您想使用SCons作为构建系统,您需要为py2创建一个SCons构建器exe.exe文件. 大致如下:

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'))

http://www.py2exe.org/

相关问题 更多 >