I have created a python virtual environment using virtualenv, after activating it, I can see where is Python installed in my shell as following:
Another way is adding LDFLAGS="-Wl,-rpath /usr/local/lib" in configure, for example
LDFLAGS="-Wl,-rpath /usr/local/lib"
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
/usr/local/lib is the path where libpython3.*.so files are in
/usr/local/lib
libpython3.*.so