Detect whether we are running in a Conda environment and adjust get_include() (#1877)
diff --git a/pybind11/__init__.py b/pybind11/__init__.py
index 5782ffe..c625e8c 100644
--- a/pybind11/__init__.py
+++ b/pybind11/__init__.py
@@ -10,9 +10,17 @@
virtualenv = hasattr(sys, 'real_prefix') or \
sys.prefix != getattr(sys, "base_prefix", sys.prefix)
+ # Are we running in a conda environment?
+ conda = os.path.exists(os.path.join(sys.prefix, 'conda-meta'))
+
if virtualenv:
return os.path.join(sys.prefix, 'include', 'site',
'python' + sys.version[:3])
+ elif conda:
+ if os.name == 'nt':
+ return os.path.join(sys.prefix, 'Library', 'include')
+ else:
+ return os.path.join(sys.prefix, 'include')
else:
dist = Distribution({'name': 'pybind11'})
dist.parse_config_files()