Python 如何修复 CMakeLists.txt 中的 CMake 错误:生成器 NMake Makefiles 不支持平台规范,但已指定平台 x64
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48624415/
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
how to fix CMake Error in CMakeLists.txt: Generator NMake Makefiles does not support platform specification, but platform x64 was specified
提问by Owase Sayyad
I want to install dlib using pip install dlibusing cmd in windows 10 But it is showing following three errors: CMake Error in CMakeLists.txt: Generator
我想使用pip install dlib在 Windows 10 中使用 cmd安装 dlib但它显示以下三个错误: CMakeLists.txt 中的 CMake 错误:生成器
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
INFORMATION: pip 9.0.1 from d:\python36\lib\site-packages (python 3.6) cmake 0.9.0 windows 10 pro(64-bit) Version: 10.0.16299 Build 16299
信息:pip 9.0.1 from d:\python36\lib\site-packages (python 3.6) cmake 0.9.0 windows 10 pro(64-bit) 版本:10.0.16299 Build 16299
采纳答案by ASHu2
I am on windows 10, python 3.5, pip 10
dlib didn't work even after installing cmake.
Solution :
我在 Windows 10 上,python 3.5,pip 10
dlib 即使在安装 cmake 后也不起作用。解决方案 :
- Add cmake into PATH(C:\Program Files\CMake\bin)
Then install using
pip
:pip install dlib==19.4
- 将 cmake 添加到 PATH(C:\Program Files\CMake\bin)
然后安装使用
pip
:pip install dlib==19.4
Works like a charm.
奇迹般有效。
Edit:
编辑:
After windows October update, the above method works, but sometimes there are errors like boost error
and cmake incompatible
.
so,
窗户月更新后,上述方法的作品,但有时也有类似的错误boost error
和cmake incompatible
。所以,
- Download and install CMake msi
- Add cmake into PATH(C:\Program Files\CMake\bin)
- Restart Windows
pip install dlib
or
pip install dlib==19.4
- 下载并安装CMake msi
- 将 cmake 添加到 PATH(C:\Program Files\CMake\bin)
- 重新启动 Windows
pip install dlib
或者
pip install dlib==19.4
回答by u10927133
I met the same problem with you, and it has been solved after installing Visual Studio C++.
我和你遇到了同样的问题,安装Visual Studio C++后已经解决了。
回答by CrazyMerlin
The easiest way is to install MS Visual Studio Community Edition, and select Visual C++ (install anything else you want but they are all optional except C++). This will install CMake and the correct compiler and libs in the correct locations.
最简单的方法是安装 MS Visual Studio Community Edition,然后选择 Visual C++(安装任何你想要的东西,但它们都是可选的,除了 C++)。这将在正确的位置安装 CMake 和正确的编译器和库。
- Download the latest Dlib.
- CD into the Dlib folder.
- Make sure the Dlib/build folder is empty ( rm -r -force .\build* )
- Run: python .\setup.py install
- 下载最新的 Dlib。
- CD 放入 Dlib 文件夹。
- 确保 Dlib/build 文件夹为空( rm -r -force .\build* )
- 运行:python .\setup.py install
If you get an error, post back here. You are probably missing a dependency or ENV variable.
如果出现错误,请在此处回帖。您可能缺少依赖项或 ENV 变量。
回答by DCG
First of all, delete CMakeCache.txt file. Later, just execute inside dlib-xx/build the command below:
首先,删除 CMakeCache.txt 文件。稍后,只需在 dlib-xx/build 中执行以下命令:
cmake -G "NMake Makefiles" ..
If you have more problems with CMAKE_C_COMPILER and CMAKE_CXX_COMPILER, you will have to install MinGW and add to the enviroment variable the path /bin of MinGW.
如果您对 CMAKE_C_COMPILER 和 CMAKE_CXX_COMPILER 有更多问题,则必须安装 MinGW 并将 MinGW 的路径 /bin 添加到环境变量中。
And if you don't have installed Visual Studio, you would to resolve future problems
如果你还没有安装 Visual Studio,你会解决未来的问题
回答by Sean Wen
I have just encountered the same problem yesterday and looked up many resources. And at last I solved it by installing Visual Studio 2017, choosing C++-related component, because it needs the C++ compiler to build the dlib.
昨天刚遇到同样的问题,查了很多资源。最后我通过安装Visual Studio 2017解决了这个问题,选择了C++相关的组件,因为它需要C++编译器来构建dlib。
回答by Masoud_qashqai
you can also go this link (dlib.whl)and download .whl version of dlib and use this command to install it
您也可以转到此链接(dlib.whl)并下载 .whl 版本的 dlib 并使用此命令进行安装
pip install .\dlib-19.8.1-cp36-cp36m-win_amd64.whl
but you should replace name of the file in above command with any file that you have downloaded
但是你应该用你下载的任何文件替换上面命令中的文件名
回答by Peter
I had the same problem. Installing dlib
from .whl
worked.
我有同样的问题。dlib
从.whl
工作安装。
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
See this post: https://stackoverflow.com/a/49538054/9524424
回答by David Dale
I had a similar problem when installing dlib
and pqkmeans
Python packages.
我在安装dlib
和pqkmeans
Python 包时遇到了类似的问题。
- Installing CMAKE or MinGW did not help.
- I solved it only after installing the Build Tools for Visual Studio from here(so installing Visual Studion IDE, which is quite huge, is not necessary). When installing, I didn't check any additional ticks - the mininal proposed set of packages was enough.
- When installing Visual Studio, I run into a problem from this question(traces of older versions of VS) and dealt with it following the answers to this question.