diff --git a/setup.py b/setup.py index 1792af8..782ff46 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ import sys import setuptools from glob import glob +import subprocess with open("README.md", "r") as fh: @@ -18,6 +19,11 @@ class get_pybind_include(object): method can be invoked. """ def __init__(self, user=False): + try: + import pybind11 + except ImportError: + if subprocess.call([sys.executable, '-m', 'pip', 'install', 'pybind11']): + raise RuntimeError('pybind11 install failed.') self.user = user def __str__(self):