Unable to run minimal example on Ubuntu
My first try failed because a numpy .h file couldn't be located:
g++ minimal.cpp -std=c++11 -I ~/anaconda3/include/python3.7m -L ~/anaconda3/lib -lpython3.7m
In file included from minimal.cpp:1:0:
matplotlibcpp.h:17:12: fatal error: numpy/arrayobject.h: No such file or directory
# include <numpy/arrayobject.h>
If i added an additional include path for numpy, I was able to build
g++ minimal.cpp -std=c++11 -I ~/anaconda3/include/python3.7m -I ~/anaconda3/lib/python3.7/site-packages/numpy/core/include -L ~/anaconda3/lib -lpython3.7m
but running the file, i received:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: initfsencoding: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
what am i doing wrong here..? thanks
Hi, even I'm getting this error. Were you able to solve this? I'm running c++ on xeus-cling and we use matplotlib-cpp for displaying the images.
If anyone gets this error, a solution for it is to force set PYTHONPATH and PYTHONHOME.
If anyone gets this error, a solution for it is to force set PYTHONPATH and PYTHONHOME.
How to set it? in the bashrc file ?
@woshichuanqilz Yes, you can do that. You can also use export to set the environment variables.
I was creating a Docker image, so here is my solution. I have set the environment variables in the dockerfile itself.