简体   繁体   English

从Windows cmd不匹配路径env变量运行scons

[英]Running scons from windows cmd mismatch path env variable

I'm trying to compile using scons 2.0.1 my project. 我正在尝试使用scons 2.0.1编译我的项目。 I set scons to use gcc for this issue. 我将scons设置为使用gcc解决此问题。 I have cygwin installed in my pm and when I'm running the command "gcc" straight from my cmd, it is recognized as a command because c:/cygwin/bin exists in the path env variable. 我在pm中安装了cygwin,当我直接从cmd运行命令“ gcc”时,它被识别为命令,因为路径env变量中存在c:/ cygwin / bin。 But when I'm running scons from the same cmd. 但是,当我从同一cmd运行scons时。 gcc is not recognized well, so I tried to see the path env variable that scons uses(I assumed that supposed to be the same as the system path), but when I put in the sconstruct the command os.system("path") or os.environ["PATH"] I get a different path variable that cygwin does not exists there. gcc不能很好地识别,所以我尝试查看scons使用的路径env变量(我假定应该与系统路径相同),但是当我将sconstruct放入命令os.system(“ path”)时或os.environ [“ PATH”]我得到了一个不存在cygwin的不同路径变量。

Please if someone know what should I do to fix that? 如果有人知道该怎么办才能解决?

Thanks allot, asaf 谢谢分配,asaf

env = Environment(ENV = {'PATH' : os.environ['PATH']})

Above is the usual fix for what you describe. 以上是您所描述的通常的修复方法。 If you want your build script to work for everyone, regardless of their personal environment, then use the following. 如果您希望自己的构建脚本适用于每个人,无论他们的个人环境如何,请使用以下内容。

env = Environment(ENV = {'PATH' : r'C:\cygwin\bin'})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM