I am writing a c extension (called my_ext) and I successfully compiled the source code to a .so file. However, my_ext depends another dynamic library installed by pip. So the link directory looks like <virtual_env>/lib/python3.6/site-packages/foo. And my link command looks like this g++ -fPIC -L<virtual_env>/lib/python3.6/site-package/foo/ -lfoo ... and I am able to link successfully. However, my question is that since my link_directory is hard-coded according to path in my laptop. When I package my python package and ship to customer, how will that extension load libfoo.so? I assume it will look for the path hard-coded by me right? In this case, customer might not be able to load libfoo.so. How can I resolve this issue?
However, my question is that since my link_directory is hard-coded according to path in my laptop

It shouldn't be. How did you come to conclusion that it is?
Run readelf -d my_ext.so, and see if there is a reference to the path on your laptop. If there is (unlikely), update your question with the output from readelf -d, and a better answer may come.
Ship Python Extension that required dynamic linking