Skip to content
Closed
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
8 changes: 6 additions & 2 deletions tensorflow_quantum/core/ops/load_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""Module to load python op libraries."""

import os
import sysconfig
from distutils.sysconfig import get_python_lib

from tensorflow.python.framework import load_library
Expand All @@ -41,6 +42,9 @@ def load_module(name):
path = resource_loader.get_path_to_datafile(name)
return load_library.load_op_library(path)
except:
path = os.path.join(get_python_lib(), "tensorflow_quantum/core/ops",
name)
path = os.path.join(get_python_lib(prefix="/usr/local"),
"tensorflow_quantum/core/ops", name)
if not os.path.exists(path):
path = path.replace("python3/",
f"python{sysconfig.get_python_version()}/")
return load_library.load_op_library(path)