jeudi 17 mai 2018

Calling python from C++ No module

With a python interpreter in a virtual env; I can load the custom python script, but I get his error (i have several libraries I load). How do I correctly get the initialization to not only point to the right interpreter but also find the installed modules like numpy and gensim among others?

from __future__ import division, absolute_import, print_function ImportError: No module named __future__ Failed to load 'my_script'

Here is how I set the interpreter:

// Initialize the Python interpreter Py_SetPythonHome((char*)"$HOME/.pyenv/versions/ipython2"); Py_Initialize(); PySys_SetPath((char*)"$HOME/.pyenv/versions/ipython2/lib/python2.7/site-packages/");

I am using cmake (on a macos).

Aucun commentaire:

Enregistrer un commentaire