Skip to content

Commit 87fa6a4

Browse files
sdebionnewjakob
authored andcommitted
Detect whether we are running in a Conda environment and adjust get_include() (#1877)
1 parent 046267c commit 87fa6a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pybind11/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@ def get_include(user=False):
1010
virtualenv = hasattr(sys, 'real_prefix') or \
1111
sys.prefix != getattr(sys, "base_prefix", sys.prefix)
1212

13+
# Are we running in a conda environment?
14+
conda = os.path.exists(os.path.join(sys.prefix, 'conda-meta'))
15+
1316
if virtualenv:
1417
return os.path.join(sys.prefix, 'include', 'site',
1518
'python' + sys.version[:3])
19+
elif conda:
20+
if os.name == 'nt':
21+
return os.path.join(sys.prefix, 'Library', 'include')
22+
else:
23+
return os.path.join(sys.prefix, 'include')
1624
else:
1725
dist = Distribution({'name': 'pybind11'})
1826
dist.parse_config_files()

0 commit comments

Comments
 (0)