I have an installed python library but I want to load it from another folder without altering my installed libraries. Using the following code, I tried to replace the path to it, but now two paths are stored to load the library and the first priority is the older one. How can I set the priority to the new one (or remove the older one)?
import pkg_resources
pkg_resources.declare_namespace('google')
pkg_resources.fixup_namespace_packages(_MY_LIBRARY_DIR)
import google.protobuf
print(google.protobuf.__path__)
Output: ['old path', 'new path']