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

Update load_module.py #616

Open
wants to merge 3 commits 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
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)