Search code examples
pythonvisual-c++x86x86-64python-wheel

Are the x86 Visual C++ libraries needed for x64 Python Wheels?


Are the x86 Visual C++ libraries (vc_redist.x86.exe) ever needed for running x64 Python Wheels with C/C++ extensions on Windows, or x64 Visual C++ libraries (vc_redist.x64.exe) are sufficient?

For instance the x64 Tensorflow Python Wheel does not need the x86 Visual C++ libraries:

tensorflow-1.10.0-cp36-cp36m-win_amd64.whl

But I don't know if it is true for every x64 Python Wheel. Maybe a Python Wheel can contain both x86 and x64 machine code.


Solution

  • I'd expect not, unless it was starting a separate process from a 32-bit executable. A 64-bit process can't execute 32-bit machine code, and most Python stuff just runs as part of the main Python process.

    (Technically you could do something crazy in hand-written assembly language in a DLL or something: a far jump to a 32-bit code segment, but then it would have a hard time making system calls. I've never heard of anyone actually doing that, and it wouldn't let you automatically make use of 32-bit libraries anyway, so it's not even really relevant for this question.)

    The use-case for starting a 32-bit process from a 64-bit Python process might be to use some 32-bit-only stuff, like legacy libraries or something. Otherwise it would just be silly to build a 32-bit instead of 64-bit executable if you were going to include a separate executable in the first place to go with your Python module.