I'm trying to use matplotlibcpp to plot a vector of y values against a vector of x values. My code looks like this:
#include <matplotlibcpp.h>
namespace plt = matplotlibcpp;
...
setenv("MPLBACKEND", "TkAgg", 1);
plt::backend("TkAgg");
setenv("PYTHONHOME", "/home/ghastor/miniconda3/envs/my_conda_env/bin/python", 1);
plt::figure();
plt::axis("equal");
plt::plot(xs,ys,"bo-");
plt::show();
This compiles fine, but gives me the following error at runtime:
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
I'd be grateful for any assistance with this, as I think it probable that I may have installed matplotlibcpp wrong or else set up my compiler properties badly.
I'm compiling/running my code in a WSL instance of Ubuntu 18.04 via VSCode. The python instance I am including in my compiler settings is one for my conda virtual environment.
Thanks!