windows下scons的问题

发布于 2024-10-05 04:17:03 字数 757 浏览 4 评论 0原文

我尝试使用 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 是一切崩溃的点。谁能帮我解决这个问题吗?

I tried to build an executable for a python script using scons, which is failing with the following trace:

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.

It seems that link /nologo /OUT is the point where everything breaks down. Can anyone help me with this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时间海 2024-10-12 04:17:03

您正在尝试从 .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'))

http://www.py2exe.org/

You're trying to build a .exe file from a .py file right? In that case, you don't need the VC++ compiler, you will need a tool like py2exe. And if you want to use SCons as a build system, you will need to create a SCons builder for py2exe.exe. Something along the lines as:

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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文