ImportError: DLL load failed while importing XXX: The specified module could not be found

Hello,

 

I already check all the answer about the subject, but i get always the same result ! 

i have test repository which contain : 

  • Test.py
  • example.so
  • example.pyd

I'm trying to load th Dll from Test.py

 

When i run test.py with python 3.6, it's work fine, but when i run it with python 3.8 it's not working and i get this message :

    import _example
ImportError: DLL load failed while importing _example: The specified module could not be found.

the code is basic for testing load  (test.py):

import sys
import os

import _example

 

Environement : 

  • Windows 10
  • PyCharm 2022.2.3
  • Path environement for pycharm are lso configured.
  • Run/Debug config of my project : 

I configure Path environement ...

- I read in documentation of python 3.8 that Turned out since version python 3.8 they added a mechanism to do this more securely. Read documentation on os.add_dll_directory.

So I try this : 

import sys
import os

#Not sur of forme !
os.add_dll_directory(os.path.join(os.path.realpath(__file__)))
import _example

But i had again the same probleme ! 

Can you please help me with this issue, thanks !

请先登录再写评论。