[Python-Dev] PYTHON3PATH

M.-A. Lemburg mal at egenix.com
Thu Jan 14 20:19:12 CET 2010


Nick Coghlan wrote:
> Guido van Rossum wrote:
>> On Wed, Jan 13, 2010 at 9:57 AM, ssteinerX at gmail.com > Or, how about
>> just removing the antiquated use of environment variables altogether
>> from Python 3 and avoid the issue completely.
>>
>> -1. They have their use, but more in controlled situations. If you
>> have "global" env vars that you only want to use with Python 2.x,
>> write a wrapper for Python 3 that invokes it with -E.
> 
> Perhaps a case can be made for Python 3 to assume -E by default, with a
> -e option to enable reading of the environment variables?
> 
> That way naive users could run Python3 without tripping over existing
> Python2 environment variables, while other tools could readily set up a
> different environment before launching Python3.

Naive users won't have PYTHONPATH or any other Python environment
variables setup.

Really, if you know that you are going to run Python 3 instead of
Python 2 or vice-versa it's easy enough to run

. py3env.sh
or
. py2env.sh

in order to setup your shell environment, much like you typically
do when using virtual Python installations or work on different
projects that require different setups.

If you just want to separate Python 2 and 3 files, use the
user site-packages dir which includes the Python version.

More experienced users could also write their own environment
switching sitecustomize.py or usercustomize.py.

And then there's the hackery option for experts that love
dirty tricks: add a .pth file which includes an "import mysetup"
line to fix-up you path and other settings.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 14 2010)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the Python-Dev mailing list