Embedding python in JUCE

I’m currently trying to embed some python code in JUCE. To do this, I understand that I need to use #include <Python.h>, as well as changing the Header Search Paths in xcode. Currently, I can execute the line #include <Python.h> by including /Library/Frameworks/Python.framework/Versions/3.11/Headers in the header search paths in my xcode project; however, I cannot run Py_Initialize(); as I get a linking error → “Undefined symbol: _Py_Initialize Linker command failed with exit code 1 (use -v to see invocation)”.

I’ve seen this post which covers an identical issue but I can’t get it working even after following the instructions. I’d greatly appreciate if somebody could provide a step by step process to embedding python in JUCE or refer me to a post that has step by step instructions to follow.


Just following up on this if anyone is interested. I was able to do what i wanted by hosting a python api locally using flask and then using WebInputStream to make an http request to that endpoint. This is much much easier than embedding python in c++ and I highly recommend it.


Try this:

1 Like