Python Forum
Finding the correct Python framework with cmake
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Finding the correct Python framework with cmake
#1
I am using the macports version of python on a Snow Leopard computer, and using cmake to build a cross-platform extension to it. I search for the python interpreter and libraries on the system using the following commands in CMakeLists.txt

include(FindPythonInterp)
include(FindPythonLibs)

However, while cmake identified the correct interpreter in /opt/local/bin, it tries to link against the wrong framework - namely the system Python framework.

Found PythonInterp: /opt/local/bin/python2.6

Found PythonLibs: -framework Python

And this causes the following runtime error

Fatal Python error: Interpreter not initialized (version mismatch?)
As soon as I replace -framework Python with /opt/local/Library/Frameworks/Python.framework/Python things seem to work as expected.

How can I make cmake link against the correct Python framework found in

/opt/local/Library/Frameworks/Python.framework/Python

rather than the system one in

/System/Library/Frameworks/Python.framework/Python
?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to make my python 3.6 unnesting function correct? PrateekG 6 3,664 Jul-24-2018, 12:09 PM
Last Post: PrateekG

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020