By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,171 Members | 809 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,171 IT Pros & Developers. It's quick & easy.

query python env

P: n/a
How does one query the python environment, ie pythonhome, pythonpath,
etc.

also, are there any HOWTO's on keeping multiple versions of python
happy?
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
David Bear wrote:
How does one query the python environment, ie pythonhome
sys.prefix
pythonpath
sys.path
etc.
sys.etc
also, are there any HOWTO's on keeping multiple versions of python
happy?


I think it is sufficiently trivial that none is needed. Just make sure
the distributions are installed in different directories.

What problems are you having?
--
Michael Hoffman
Jul 18 '05 #2

P: n/a
David Bear wrote:
How does one query the python environment, ie pythonhome, pythonpath,
etc.

also, are there any HOWTO's on keeping multiple versions of python
happy?


In general, (and in this case) the answer is system-specific.
You need to explain (A) what operating system, and (B) what you
mean by multiple Python versions.

For example, for Windows 2K/XP, As long as you try for only
distinct major versions (2.2.x, 2.3.x, 2.4.x). There should
not be a problem. The primary issues are where (and how) does
your system get to the python files.
--Scott David Daniels
Sc***********@Acm.Org
Jul 18 '05 #3

P: n/a
Michael Hoffman wrote:
David Bear wrote:
How does one query the python environment, ie pythonhome

sys.prefix
> pythonpath


sys.path
etc.


[...]
I suspect rather that the OP is looking for os.environ, as in:

[sholden@headrat sholden]$ ENVAR=value
[sholden@headrat sholden]$ export ENVAR
[sholden@headrat sholden]$ python
Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
[GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import os
os.environ["ENVAR"]

'value'
regards
Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
Jul 18 '05 #4

P: n/a
Steve Holden wrote:
I suspect rather that the OP is looking for os.environ, as in:


He was using the examples of PYTHONHOME and PYTHONPATH which have
specific meanings. Using sys.prefix is better than
os.environ["PYTHONHOME"], which is unlikely to be set.
--
Michael Hoffman
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.