query python env

D

David Bear

How does one query the python environment, ie pythonhome, pythonpath,
etc.

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

Michael Hoffman

David said:
How does one query the python environment, ie pythonhome
sys.prefix

> pythonpath
sys.path


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?
 
S

Steve Holden

[...]
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
 
S

Scott David Daniels

David said:
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
(e-mail address removed)
 
M

Michael Hoffman

Steve said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top