[CMake] CMake finds the wrong Python interpreter on Windows

Bill Hoffman bill.hoffman at kitware.com
Thu Feb 25 10:44:51 EST 2010


Noel O'Boyle wrote:
> On 24 February 2010 22:20, Bill Hoffman <bill.hoffman at kitware.com> wrote:
>> Noel O'Boyle wrote:
>>> Hello all,
>>>
>>> With the following CMakeLists.txt on Windows...
>>>
>>> project("MyProject" NONE)
>>> find_package(PythonInterp)
>>> find_package(PythonLibs)
>>>
>>> Using CMake 2.6.4 (or CMake 2.8), I get
>>>
>>> -- Found PythonInterp: C:/Cygwin/bin/python2.5.exe
>>> -- Found PythonLibs: C:/Python26/libs/python26.lib
>>>
>>> instead of
>>>
>>> -- Found PythonInterp: C:/Python26/python.exe
>>> -- Found PythonLibs: C:/Python26/libs/python26.lib
>>>
>>> This is a Windows XP machine, with standard installs of Python 2.5 and
>>> 2.6 and a standard Cygwin install of Python 2.5, where my PATH
>>> includes C:\Python26 before C:\Cygwin\bin. Why doesn't CMake just use
>>> the Python interpreter on my path as a first appoximation?
>>>
>> It should use the one in your PATH...   What is your PATH set to? Might be
>> something in the PATH that confuses CMake...   I have seen issues with " in
>> the PATH.
> 
> No ", but lots of spaces...my path is as follows:
> 
> C:\Tools\OpenBabel\nightly\ob-build>echo %PATH%
> C:\Program Files\ImageMagick-6.5.8-Q16;;C:\Program Files\MiKTeX 2.8\miktex\bin;C
> :\Python26\Lib\site-packages\PyQt4;C:\Program Files\CollabNet\Subversion Client;
> C:\windows\system32;C:\windows;C:\windows\system32\WBEM;C:\Program Files\QuickTi
> me\QTSystem\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Fi
> les\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Sha
> red\9.0\DLLShared\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Support Too
> ls\;C:\Program Files\OpenBabel-2.2.3;C:\Program Files\OpenBabel-2.2.1;C:\Python2
> 6;C:\Program Files\GaussSumexe-2.1.4\GaussSum-2.1.4\gnuplot400\bin;C:\Program Fi
> les\CMake 2.6\bin;C:\Program Files\GnuWin32\bin;C:\Tools\swig\swigwin-1.3.40;C:\
> Program Files\CollabNet\Subversion Client;C:\Cygwin\bin;C:\Data\DrugBank
> 
> The first python found on the PATH is my regular Windows Python as
> shown by the following:
> 

Nothing jumps out...

Can you try in a shell setting the PATH to:

PATH=C:\Python26

Then run CMake, and see what it does?

-Bill


More information about the CMake mailing list