How to use Panda3d with brewed python

Hi! I compiled, built, and installed Panda3d using a brewed python, but when i try to import Panda3d modules with the brewed interpreter, i get a segmentation fault error. I can use the ppython executable to run samples and generally code, but is it possibile to use the brewed version to run Panda3d code? Before the compilation i edited changing:

#SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config")
IncDirectory("PYTHON", "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/include")
LibName("PYTHON", "-lpython2.7")
LibDirectory("PYTHON", "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib")

but without results.

Thanks anyway :slight_smile:

That looks like it should generally work, except you also have to edit and find SdkLocatePython. Make sure that it assigns SDK[“PYTHON”] to your include directory, SDK[“PYTHONEXEC”] to the Python executable, and SDK[“PYTHONVERSION”] to “python2.7”.

Why we have two mechanisms for detecting Python, I’m not sure.

After changing this you will have to make sure you do a full rebuild by removing the “built” directory.

I’ll think about adding command line switches to more easily make this happen.

Actually, now that I think of it, it used to be that makepanda on OS X would automatically compile for whatever version of Python you ran it with. I disabled that recently because we use “-framework Python” to link it which caused it to pick up the system Python framework anyway.

Maybe we should just go back to that approach and use “-lpython2.7” across the board.