how to fix CMake Error in CMakeLists.txt: Generator NMake Makefiles does not support platform specification, but platform x64 was specified

I am on windows 10, python 3.5, pip 10
dlib didn't work even after installing cmake. Solution :

  • Add cmake into PATH(C:\Program Files\CMake\bin)
  • Then install using 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,

  • 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
    

I met the same problem with you, and it has been solved after installing Visual Studio C++.


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.

  • 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

If you get an error, post back here. You are probably missing a dependency or ENV variable.