1

I am having trouble importing my_so_file.cpython-35m-x86_64-linux-gnu.so as a python module. This answer helps to some extent, but yields an error ImportError: DLL load failed while importing my_so_file: %1 is not a valid Win32 application.

As the answer here suggests, I made sure that both Windows and Python are 64-bit. They also add opencv binaries path to PATH environment variable, but this does not seem to be relevant to me as I don't deal with opencv. But if I have to add something to PATH, I don't quite understand what it would have to be.

Thank you!

Python
  • 359
  • 2
  • 16
  • 1
    The obvious problem here is that you have a binary built for linux (.so) and you’re trying to use it on Windows. You need to use a DLL built with the same code on Windows. – tromgy Nov 21 '21 at 10:53
  • @tromgy but what if I have only built for linux and no built for windows? Is there any workaround? – Python Nov 21 '21 at 10:58
  • 2
    If you have the source you can try building it on Windows. Lacking that you can use a VM and set up Linux on it. Another possibility to look into is [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/about) – tromgy Nov 21 '21 at 11:05

0 Answers0