Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for finding DLL's #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions mkl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys
import os


def add_dll_directory():
"""mkl package DLL's need to be available so they can be dynamically linked"""
path = os.path.join(sys.prefix, "Library\\bin")
try:
os.add_dll_directory(path)
except AttributeError:
environ_path = os.environ.get('PATH', '')
if path not in environ_path:
os.environ['PATH'] = os.pathsep.join((path, environ_path))


class RTLD_for_MKL():
def __init__(self):
Expand All @@ -45,6 +58,8 @@ def __exit__(self, *args):
sys.setdlopenflags(self.saved_rtld)
self.saved_rtld = None

add_dll_directory()

with RTLD_for_MKL():
from . import _mklinit

Expand Down