version-specific PYTHONPATH env var

What do people think about the idea of a version-specific PYTHONPATH environment variable? Something like PYTHON25PATH or the like. Reason I ask is that on our production systems, we have a couple of versions of Python being used by different systems. Yes, yes, in a perfect world they'd be all updated at the same time, sure. There's occasionally issues with the PYTHONPATH being pointed at something like .../lib/python2.4/site-packages or the like, and then have issues when python2.3 or some other different version is run. If we allowed people to optionally specify a more specific version this problem would go away. Anthony -- Anthony Baxter <anthony@interlink.com.au> It's never too late to have a happy childhood.

I recommend not setting these variables at all, or to use wrapper scripts that set them instead. But there's probably some reason why you can't do that... On 3/8/07, Anthony Baxter <anthony@interlink.com.au> wrote:
-- --Guido van Rossum (home page: http://www.python.org/~guido/)

Anthony Baxter schrieb:
What do people think about the idea of a version-specific PYTHONPATH environment variable?
I agree with Guido. I normally need an application-specific PYTHONPATH, and I do that by editing the start script adding a sys.path.append into it (these days, Python applications often come with a tiny start script that then imports the main functionality from a module). Examples where I do this include buildbot, moinmoin, and roundup. As a system's administrator, I discourage people from setting PATH, LD_LIBRARY_PATH, PYTHONPATH, and, if possible, CLASSPATH. Instead, I try to manage the system so that system-wide software is available to every user without additional setup. Regards, Martin

On 3/9/07, Anthony Baxter <anthony@interlink.com.au> wrote:
Few weeks ago I actually needed exactly this functionality. I worked around it with a .pth file installed for each version of python I'm using with the following contents: import sys; sys.path.insert(0, os.path.expanduser("~/pylib%s.%s" % sys.version_info[:2])) import site, os, sys; site.addsitedir(os.path.expanduser("~/pylib%s.%s" % sys.version_info[:2]))

I recommend not setting these variables at all, or to use wrapper scripts that set them instead. But there's probably some reason why you can't do that... On 3/8/07, Anthony Baxter <anthony@interlink.com.au> wrote:
-- --Guido van Rossum (home page: http://www.python.org/~guido/)

Anthony Baxter schrieb:
What do people think about the idea of a version-specific PYTHONPATH environment variable?
I agree with Guido. I normally need an application-specific PYTHONPATH, and I do that by editing the start script adding a sys.path.append into it (these days, Python applications often come with a tiny start script that then imports the main functionality from a module). Examples where I do this include buildbot, moinmoin, and roundup. As a system's administrator, I discourage people from setting PATH, LD_LIBRARY_PATH, PYTHONPATH, and, if possible, CLASSPATH. Instead, I try to manage the system so that system-wide software is available to every user without additional setup. Regards, Martin

On 3/9/07, Anthony Baxter <anthony@interlink.com.au> wrote:
Few weeks ago I actually needed exactly this functionality. I worked around it with a .pth file installed for each version of python I'm using with the following contents: import sys; sys.path.insert(0, os.path.expanduser("~/pylib%s.%s" % sys.version_info[:2])) import site, os, sys; site.addsitedir(os.path.expanduser("~/pylib%s.%s" % sys.version_info[:2]))
participants (4)
-
"Martin v. Löwis"
-
Anthony Baxter
-
Guido van Rossum
-
Ralf Schmitt