[CMake] CMake finds the wrong Python interpreter on Windows
Noel O'Boyle
baoilleach at gmail.com
Thu Feb 25 14:02:01 EST 2010
On 25 February 2010 18:41, David Cole <david.cole at kitware.com> wrote:
> On Thu, Feb 25, 2010 at 1:29 PM, Bill Hoffman <bill.hoffman at kitware.com>
> wrote:
>>
>> Noel O'Boyle wrote:
>>
>>>
>>> Done. I've attached the result (off list). In summary it seems to be
>>> searching for python2.6.exe first, instead of python.exe.
>>>
>>
>> OK, so that is the problem....
>>
>> It looks for names in this order:
>>
>> NAMES python2.6 python2.5 python2.4 python2.3 python2.2 python2.1
>> python2.0 python1.6 python1.5 python
>>
>>
>> It will prefer python2.6 over python in the PATH, and it has no way of
>> knowing or caring if one is cygwin or not. I don't think there is much we
>> can do about this.
>>
>> I should have noticed this:
>> C:/Python26/python.exe
>> C:/Cygwin/bin/python2.5.exe
>>
>>
>> I suppose one fix could be to to have the windows one prefer python over
>> any of the named version ones...
>>
>
> Same problem as ever: when multiple versions are installed an automatic
> "find" result cannot be relied upon to choose the right one. In that case,
> caller should set PYTHON_EXECUTABLE explicitly prior to doing the find call.
> On the other hand, we should not have a version/path mismatch between python
> exes and libs and headers. We should consistently find one first, and then
> find the other stuff relative to that. Or leave that other stuff set as
> NOTFOUND if there are no libs/headers relative to the exe.
> This should be as easy as changing which Qt is found: change
> QT_QMAKE_EXECUTABLE and other stuff gets re-found. Same logic should apply
> here: change PYTHON_EXECUTABLE and other stuff should be re-found...
Well, I will leave the details to you guys, but when I want to run
python on any platform I type "python", and so it seems to be that
"python.exe" should be ahead of all of the other options in the list.
> David
>
More information about the CMake
mailing list