Do pyd files only work against the linked python version?

634 Views Asked by At

I compiled SimpleElastix for both Windows and Linux months ago. The SimpleElastix build process produced a .so file under Linux and a .pyd under Windows for use with Python. I was able to import SimpleElastix under python 3.6 in both Linux and Windows and use the library, no problem.

Fast forward to now. I've upgraded to python 3.10. I am still able to import SimpleElastix under Linux using the same .so, but I cannot do the same under Windows. Python 3.10 cannot find the .pyd file no matter what I do. I tried adding the location to PATH, PYTHONPATH, and even os.add_dll_directory. I'm pretty sure if I simply re-built SimpleElastix with Python 3.10 in my PATH, it would probably work. The only trouble is, the project seems semi dead and the build process is currently broken due to unpinned dependencies.

My question is: Are pyd files only importable against a single specific python version (the one it was linked against)? It seems so since examples I read online for creating pyd files involve passing i.e. -lpython36 to the compiler. Is there a way to build pyd files like Linux .so files that don't have that limitation? Is there a way to "relink" a .pyd against a newer python version without access to the original build?

0

There are 0 best solutions below