9 ms·
I have done the following in the past: 1. pip install libfoo==1.x.x 2. pip install libfoo==2.x.x --target ~/libs/libfoo_v2 # vendor libfoo v2 3. import sys
by pid-1 2y ago
I have done the following in the past:
1. pip install libfoo==1.x.x
2. pip install libfoo==2.x.x --target ~/libs/libfoo_v2 # vendor libfoo v2
3.
import sys
import libfoo
original_sys_path = sys.path.copy()
sys.path.insert(0, '~/libs/libfoo_v2')
import libfoo as libfoo_v2
sys.path = original_sys_path
There are caveats of course. But works for simple cases.