Calling Python from C - error loading shared libraries

For the record, this is mostly a duplicate of this StackOverflow question.

I’m not entirely sure where I should post this, but I am trying to call a Python function from within C. Whenever I try to run the compiled program, I get the following error:

~/Documents/code/test: error while loading shared libraries: libpython3.9.so.1.0: cannot open shared object file: No such file or directory
[1] + Done                       "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-cdpcz1c5.vwd" 1>"/tmp/Microsoft-MIEngine-Out-j5b1thxt.2vz"

The build command I’m using is:

/usr/bin/gcc -I${HOME}/Documents/git/resist/code -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I${HOME}/anaconda3/envs/myenv/include/python3.9 -I${HOME}/anaconda3/envs/myenv/lib/python3.9/site-packages/numpy/core/include/numpy -Wno-unused-result -Wsign-compare -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -ffunction-sections -pipe -isystem ${HOME}/anaconda3/envs/myenv/include -fdebug-prefix-map=/opt/conda/conda-bld/python-split_1649141344976/work=/usr/local/src/conda/python-3.9.12 -fdebug-prefix-map=${HOME}/anaconda3/envs/myenv=/usr/local/src/conda-prefix -I${HOME}/anaconda3/envs/myenv/include -DNDEBUG -O3 -Wall ${HOME}/Documents/git/resist/code/test.c -L${HOME}/anaconda3/envs/myenv/lib/python3.9/config-3.9-x86_64-linux-gnu -L${HOME}/anaconda3/envs/myenv/lib -lcrypt -lpthread -ldl -lutil -lm -lpython3.9 -Xlinker -export-dynamic -o ${HOME}/Documents/git/resist/code/test

A lot of the commands I got from calling python3.9-config --cflags and python3.9-config --ldflags. Any idea how I can overcome the error I’m getting with libpython3.9.so.1.0?