Skip to content

Improve case on Mac where cmake fails to find Python with the custom search path. - #49

Merged
pcmoritz merged 8 commits into
masterfrom
findpython
Nov 20, 2016
Merged

pcmoritz merged 8 commits into
masterfrom
findpython

Conversation

@robertnishihara

@robertnishihara robertnishihara commented Nov 19, 2016 •

Copy link
Copy Markdown
Collaborator

CMake tries to find the Python libraries to use during compilation by searching near the Python executable. However, when the user is inside of a virtualenv, the executable is inside the virtual environment directory while the Python libraries are in their original location.

However, (in the cases I tested) we can still find the Python include directories without trouble, by running the following.

python -c "from distutils.sysconfig import *; print get_python_inc()"

That gives us a hint about where the Python libraries are. So if we can't find the libraries near the executable, we look for them near the include directories.

This seems to address the virtualenv case (and hopefully most cases).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants