I'm trying to use two different releases of a same library (installed with easy_install --multi-version) from within the same python script. The general idea is illustrated in the code below.
If I call each version independently, everything is fine. If I want to call one version and then the other, I get a VersionConflict error.
There must be a way to "unload" the previous distribution from the working set before loading the other one but I seem to always get lost reading the pkg_resources manual.
Can anyone point me to the right way to go about this? Thanks a lot.
#!/usr/local/bin/python2.7
# -*- coding: utf-8 -*-
def test1():
import pkg_resources
pkg_resources.require('obspy.core==0.6.2')
import obspy.core
try:
print obspy.core.__version__
except:
print "Can not read obspy.core version"
def test2():
import pkg_resources
pkg_resources.require('obspy.core==0.4.8')
import obspy.core
try:
print obspy.core.__version__
except:
print "Can not read obspy.core version"
if __name__ == '__main__':
test1()
test2()