Skip to content

Commit

Permalink
Add DLL Search Paths for Windows with Python 3.8+
Browse files Browse the repository at this point in the history
Aims to Fix #457
  • Loading branch information
thealanjason authored Feb 11, 2024
1 parent 8403d74 commit 0b6bf2b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pysrc/juliacall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ def backtrace(self):

def init():
import os
## For Windows and Python 3.8+ need to add dll search paths
import sys
if os.name == "nt" and sys.hexversion >= 0x308000:
conda_environment_path = os.environ["CONDA_PREFIX"]
dll_search_paths = [
conda_environment_path,
os.path.join(conda_environment_path, "Library", "mingw-w64", "bin"),
os.path.join(conda_environment_path, "Library", "usr", "bin"),
os.path.join(conda_environment_path, "Library", "bin"),
os.path.join(conda_environment_path, "Scripts"),
os.path.join(conda_environment_path, "bin")
]
for path in dll_search_paths:
if os.path.exists(path):
os.add_dll_directory(path)

import ctypes as c
import sys
import subprocess
Expand Down

0 comments on commit 0b6bf2b

Please sign in to comment.