Sunday 11 July 2021

Python not able to find the external dependent dll

I am using Python3.6. I have created a C++ extension using (pybind11)[https://ift.tt/1VRpi0V]. I copied the compiled *.pyd file along with the dependent dll to the site packages. But when I try to load any functions from the external DLL, python complains that the function is not present. If I want to access the function, I need write

sys.path.append(r'C:\Users\test\AppData\Local\Programs\Python\Python36\Lib\site-packages\CppProject')

or I need to add the same path to the PYTHONPATH environment variable.

Why Python is not able to load the function even though it is present in the same path as the pyd? I don't want to append the sys path everytime I need to use the module or use the environment variable? Is there any way to avoid this? Is there any way to add this path to the sys automatically whenever the user import the module?

enter image description here



from Python not able to find the external dependent dll

No comments:

Post a Comment