I'm trying to convert a python script into Cython executable binary. It also uses other modules like Tensorflow, pandas, numpy, matplotlib, seaborn, and pickle. Here is my compile command.
cython --embed -o foo.c foo.pyx
gcc -Os -o FOOEXE foo.c -I /usr/include/python3.6m/ -L/workdirectory/somePythonEnviroment-venv/lib -lpython3.6m -lpthread -lm -lutil -ldl
I downloaded all the required modules with pip and running it as a python script is fine. When I compile it into a C binary using cython magic. The first thing it says
import pandas as pd
No module named 'pandas'
Which I agree. I had assume it would compile all included modules too and put it in the binary. How do I INCLUDE the module pandas? How do I include any python module I install with pip into a cython project. Does cython only work with basic Python code and libraries from python.h? Do I need to have the original python module files with the excutable?
embed
- your program will need some setup to make it work with site-packages, e.g. https://mcmap.net/q/49212/-importerror-after-cython-embed/5769463 and https://mcmap.net/q/48835/-minimal-set-of-files-required-to-distribute-an-embed-cython-compiled-code-and-make-it-work-on-any-machine/5769463 – Tinny