Last active
February 7, 2017 13:46
-
-
Save Waltibaba/f638d5aabeecffe2471b0ca647ce8adf to your computer and use it in GitHub Desktop.
Revisions
-
Waltibaba revised this gist
Feb 7, 2017 . 1 changed file with 13 additions and 8 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,21 @@ 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. -
Waltibaba revised this gist
Feb 7, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ http://stackoverflow.com/questions/15291500/i-have-2-versions-of-python-installed-but-cmake-is-using-older-version-how-do I had a similar problem, and resolved it using @Paul's answer as a hint. I 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. -
Waltibaba created this gist
Feb 7, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ I had a similar problem, and resolved it using @Paul's answer as a hint. I 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 Path to a program PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python Path to a directory PYTHON_INCLUDE_DIR:PATH=/usr/include/python3.2 Path to a library 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. 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.