Thanks for your reply Ronald. I do run multiple versions, but I change the symlink of Current. Do you mean because people change versions in other ways, say through a shell alias rather than change the symlink? I can see that the sys.prefix approach is safer. thanks,
David On 06/11/2007, at 1:37 AM, Ronald Oussoren wrote: > > On 5 Nov, 2007, at 3:51, David Worrall wrote: > >> Hi All, >> >> We're doing some work around different versions of Python on OSX (and >> what's in their respective site-packages directory), >> and I was wondering: >> >> Given that we can pick up the the version number of the current >> instantiation using sys.version, >> is there a direct way of computing the locating values for x and y in >> '/Library/Frameworks/Python.framework/Versions/Current/lib/ >> pythonx.y/' >> >> other than through concatenating the above string with a splice of >> sys.version? > > No. > > BTW. The library location is os.path.join(sys.prefix, 'lib', 'python > %d.%d'%(sys.version_info[:2])). This should resolve to a path that > doesn't refer to 'Versions/Current' but to 'Versions/x.y'. Do not > assume that the 'Current' link will point to currently running > version of Python, a user might have installed multiple versions of > python. > > Ronald >> >> >> thanks, >> >> David >> _________________________________________________ >> experimental polymedia: www.avatar.com.au >> Sonic Communications Research Group, >> University of Canberra: creative.canberra.edu.au/scrg/ >> >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG@python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > _________________________________________________ experimental polymedia: www.avatar.com.au Sonic Communications Research Group, University of Canberra: creative.canberra.edu.au/scrg/ _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig