Last active
February 7, 2017 13:46
-
-
Save Waltibaba/f638d5aabeecffe2471b0ca647ce8adf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/15291500/i-have-2-versions-of-python-installed-but-cmake-is-using-older-version-how-do | |
EITHER: | |
find_package( PythonLibs 2.7 REQUIRED ) # if it already has a find_package(PythonLibs) | |
OR: | |
needed to use python2.7 to compile an older library, but cmake keeps picking up my python3.2 libraries (and executable). | |
First, I ran cmake with default options, then edited the CMakeCache.txt file which it generated. I did it this way primarily because I didn't know the proper -D... incantations to cause cmake to get the python library and include paths, etc right in the first place. | |
In my CmakeCache.txt, I found lines like this | |
PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python | |
PYTHON_INCLUDE_DIR:PATH=/usr/include/python3.2 | |
PYTHON_LIBRARY:FILEPATH=/usr/lib/libpython3.2.so | |
And replaced every occurrence of python3.2 with python2.7. I also had to rename the PYTHON_EXECUTABLE to use python2.7, since python is a symlink to python3.2 on my system. | |
PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python2 | |
PYTHON_INCLUDE_DIR:PATH=/usr/include/python2.7 | |
PYTHON_LIBRARY:FILEPATH=/usr/lib64/libpython2.7.so | |
Then I reran cmake. Because it prefers its cached values to actually looking for the libraries, this should work in all cases. At least, it did in mine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment