Can multiprocessing.Process() use a different version of the interpreter?

Scott Pigman pigmartian at gmail.com
Mon Oct 4 12:39:53 EDT 2010


I want to use the 64 bit version of python but run some code inside a
spawned process that uses the 32 bit version.  Is there an official
way to do this, or can anybody make a recommendation about the
cleanest way to do this? If someone has a better solution to the
problem I describe below, I'd appreciate hearing that too. I'm using
python 2.7, but could go to 3.x if that has better support for this.

My program interacts with two different commercial libraries by using
ctypes to execute functions inside their DLLs.  One library only
exists in a 32 bit version.  The second library has both 64 and 32 bit
versions.  The code was initially developed for a 32 bit platform, but
now I need to support a user on a 64 bit machine as well.  I've
learned that ctypes can only interact with libraries which match the
version of python that is running --- 32 bit python can use 32 bit
DLLs, 64 bit python can use 64 bit DLLs, so when I'm running on a 64
bit machine with one 64 bit library and the other at 32 bits, I can't
use the 32 bit library.

I believe that the solution is to have both win32 and x64 versions of
python installed, and then execute the win32 code inside of a new
process which uses the win32 version of Python.  I'm already using
multiprocessing to run that code inside a new process because the two
libraries have conflicts and need to run in separate memory space.  If
I could just specify that I want the new process to use a different
version of the interpreter I think I'd be all set, but I don't see a
way of doing that.



More information about the Python-list mailing list