0

I have a python file, and it is calling a .pyd file. However, this .pyd file depends on a DLL.

I can get it to work if I either:

  • Copy the dll in question to the same location as the .pyd file.
  • run the command os.add_dll_directory('MYPATH\\LOCATION')

I was wondering if there is a way to add this permanently. I have read and tried what was suggested here: Permanently adding a file path to sys.path in Python but unfortunately, creating the .pth file didnt work.

Danny
  • 13
  • 4
  • Define "permanently"... – Selvin Apr 20 '21 at 22:24
  • Permanently: Every time I start python (e.g., a jupyter notebook) it is available. – Danny Apr 20 '21 at 23:41
  • When copying a file in some location, the file stays there either until it's erased or the storage medium goes bad, so that would qualify as "permanently". Note: *.pth* has nothing to do with this. – CristiFati Apr 21 '21 at 05:27

1 Answers1

0

The only solution I found (which I don't like) is to create somewhere in Python path a file sitecustomize.py and fill it with the following content:

import os
os.add_dll_directory('C:\\path\\to\your\\dll\folder')
os.add_dll_directory('C:\\path\\to\another\\dll\folder')

However, I am much missing any equivalent of the Linux LD_LIBRARY_PATH variable.

Maciek D.
  • 2,754
  • 1
  • 20
  • 17