boostorg / build

B2 makes it easy to build C++ projects, everywhere.
Boost Software License 1.0
231 stars 48 forks source link

Boost.Python can not find python on windows if path contains spaces #729

Open Grantim opened 3 years ago

Grantim commented 3 years ago

This issue was mentioned here, when building boost.python with numpy. Everything is ok if python is installed in path without spaces, and it does not find system python (and thereafter numpy) if spaces are present in the path. So attached file can be applied as patch (mb it is not the best fix, but still works, please have a look).

I faced this issue on boost version 1.75.0

pavel-machyniak commented 2 years ago

I have the same issue with current boost 1.80. I just need to build the boost libraries on Windows (using vc143) and choose correct python interpreter. I have 32-bit python installed in standard location: C:\Program Files (x86)\Python310-32 There is no python configured on system path nor in system variables. I bootstrap the boost and enter python configuration either to project-config.jam or to tools\build\src\user-config.jam or tools\build\src\site-config.jam:

using python : : "C:/Program Files (x86)/Python310-32/python.exe" ;

or:

using python : : "C:\\Program Files (x86)\\Python310-32\\python.exe" ;

Result:

notice: [python-cfg] Configuring python...
notice: [python-cfg]   user-specified cmd-or-prefix: "C:/Program Files (x86)/Python310-32/python.exe"
notice: [python-cfg] Checking interpreter command "C:/Program Files (x86)/Python310-32/python.exe"...
notice: [python-cfg] running command 'DIR /-C /A:S "C:\Program Files (x86)\Python310-32\python.exe" 2>&1'
notice: [python-cfg] running command 'C:/Program Files (x86)/Python310-32/python.exe -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1'
notice: [python-cfg] ...does not invoke a working interpreter

Note that:

That being said, there is definitely problem with spaces in the path. When I change the setting to ancient 8.3 compatibility format:

using python : : c:/PROGRA~2/PYTHON~1/python.exe ;

Then it runs correctly:

notice: [python-cfg] Configuring python...
notice: [python-cfg]   user-specified cmd-or-prefix: "c:/PROGRA~2/PYTHON~1/python.exe"
notice: [python-cfg] Checking interpreter command "c:/PROGRA~2/PYTHON~1/python.exe"...
notice: [python-cfg] running command 'DIR /-C /A:S "C:\Program Files (x86)\Python310-32\python.exe" 2>&1'
notice: [python-cfg] running command 'c:/PROGRA~2/PYTHON~1/python.exe -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1'
notice: [python-cfg] ...requested configuration matched!
notice: [python-cfg] Details of this Python configuration:
notice: [python-cfg]   interpreter command: "c:/PROGRA~2/PYTHON~1/python.exe"
notice: [python-cfg]   include path: "c:\PROGRA~2\PYTHON~1\Include"
notice: [python-cfg]   library path: "c:\PROGRA~2\PYTHON~1\libs"
notice: [python-cfg]   DLL search path: "c:\PROGRA~2\PYTHON~1"