matplotlib-cpp
matplotlib-cpp copied to clipboard
Error on M1 Mac with Miniforge venv
Hi all. I encounter a problem on compiling the matplotlib-cpp toy code provided in this github repo. I compile the sample code by
g++ test.cpp -std=c++17 \
-I /Users/pangkachun/matplotlib-cpp \
-I /Users/pangkachun/miniforge3/envs/np_veclib/include/python3.9 \
-I /Users/pangkachun/miniforge3/envs/np_veclib/lib/python3.9/site-packages/numpy/core/include \
-L /Users/pangkachun/miniforge3/envs/np_veclib/lib -lm \
-lpython3.9 \
-o result_plot
However, terminal returns an error message regarding on the libpython3.9.dylib. This file exists in /Users/pangkachun/miniforge3/envs/np_veclib/lib and I have no idea why the error message says not found. The error messgae is listed below:
dyld[37343]: Library not loaded: @rpath/libpython3.9.dylib
Referenced from: /Users/pangkachun/result_plot
Reason: tried: '/usr/local/lib/libpython3.9.dylib' (no such file), '/usr/lib/libpython3.9.dylib' (no such file)
zsh: abort ./result_plot
Is there any guideline to help me to solve this problem?