mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 07:02:11 +00:00
Detect whether we are running in a Conda environment and adjust get_include() (#1877)
This commit is contained in:
parent
046267c629
commit
87fa6a4342
@ -10,9 +10,17 @@ def get_include(user=False):
|
|||||||
virtualenv = hasattr(sys, 'real_prefix') or \
|
virtualenv = hasattr(sys, 'real_prefix') or \
|
||||||
sys.prefix != getattr(sys, "base_prefix", sys.prefix)
|
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:
|
if virtualenv:
|
||||||
return os.path.join(sys.prefix, 'include', 'site',
|
return os.path.join(sys.prefix, 'include', 'site',
|
||||||
'python' + sys.version[:3])
|
'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:
|
else:
|
||||||
dist = Distribution({'name': 'pybind11'})
|
dist = Distribution({'name': 'pybind11'})
|
||||||
dist.parse_config_files()
|
dist.parse_config_files()
|
||||||
|
Loading…
Reference in New Issue
Block a user