windows MinGW sh.exe 不能在您的路径中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41333215/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MinGW sh.exe must NOT be in your path
提问by Septimus
Currently trying to setup my C development environment on windows with MinGW and it looks like CMAKE is giving me the following error:
目前正在尝试使用 MinGW 在 windows 上设置我的 C 开发环境,看起来 CMAKE 给了我以下错误:
sh.exe was found in your PATH, here:
C:/Program Files/Git/user/bin/sh.exe
For MinGW make to work correctly sh.exe must NOT be in your path.
Run cmake from a shill that does not have sh.exe in your PATH.
If you want to use a UNIX shell, then use MSYS Makefiles
That error is being thrown inside of CLion IDE. I am not sure if I need to change settings inside of CLion or what. I have looked at my windows path and I do not see any reference to sh.exe.
该错误是在 CLion IDE 中抛出的。我不确定是否需要更改 CLion 内部的设置或什么。我查看了我的 Windows 路径,但没有看到任何对 sh.exe 的引用。
My path is as follows:
我的路径如下:
C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Nodist\bin;C:\Users\wesle\AppData\Local\Microsoft\WindowsApps;
回答by Elia
For me, this simple parameter passed to cmake has worked -DCMAKE_SH="CMAKE_SH-NOTFOUND"
.
对我来说,这个传递给 cmake 的简单参数已经起作用了-DCMAKE_SH="CMAKE_SH-NOTFOUND"
。
回答by lucrib
Check you really do not have sh.exe
in your PATH
by opening a Windows Command Lineand typing where sh.exe
. If you have this file in your path, the command will return its path (then you should remove it from your PATH
) else if windows return it was not found, try to clean up the folder CMakeFiles
and a file name CMakeCache.txt
somewhere inside your project folder.
检查你真的没有sh.exe
在你PATH
打开一个Windows命令行和打字where sh.exe
。如果你在你的路径有这个文件,该命令将返回其路径(那么你应该从你删除它PATH
否则,如果窗口返回它没有被发现,尝试清理的文件夹)CMakeFiles
和文件名CMakeCache.txt
的项目文件夹内的某个地方。
回答by A.Najafi
Just add
只需添加
set(DCMAKE_SH="CMAKE_SH-NOTFOUND")
set(DCMAKE_SH="CMAKE_SH-NOTFOUND")
to your
给你的
CMakeLists.txt file
CMakeLists.txt 文件
回答by g10guang
If you have install git, just add gitPath/binto your User or System environment variable PATH.
如果您安装了 git,只需将gitPath/bin添加到您的用户或系统环境变量 PATH。
For example, I add C:\Program Files\Git\binto my User PATH environment variable.
例如,我将C:\Program Files\Git\bin 添加到我的用户 PATH 环境变量中。
回答by u12238526
It's the problem of your git's path.
I assume you are using the Clion, just check if you have added %gitpath%\bin
to your path, that's where the problem is. You should use %gitpath%\cmd
instead, typically for me it's D:\Git\cmd
.Since the former one includes sh.exe
in your path which results in the error.
这是你的git路径的问题。
我假设您正在使用 Clion,只需检查您是否已添加%gitpath%\bin
到您的路径中,这就是问题所在。您应该%gitpath%\cmd
改用,通常对我来说是D:\Git\cmd
.Since 前一个包含sh.exe
在您的路径中,这会导致错误。