i'm distributing an in-house python lib where i'd like to make it such that if the user is using anaconda when running this file, that updates to the dependencies of the library will be made automatically. (this is by request. if it were up to me, i would let the users control their own packages.)
so far, i've come up with something like
def _user_has_conda():
cmd = 'conda --help'
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if len(out) > 0 and len(err) == 0:
return True
else:
return False
but this really only tells me if the user has anaconda installed on their system, and not whether the current python process is running in the anaconda environment.
what i notice is that when i start a python or ipython shell, i see "Python 3.3.3 |Continuum Analytics, Inc|" at the top. my next idea would be to try to find how to get this string to see if "Continuum Analytics" is there, and if so, assume that the user is running in anaconda.
i'm sure there are better ideas out there, and that's why i'm here.
thank you.