[Python-Dev] PYTHON3PATH

M.-A. Lemburg mal at egenix.com
Thu Jan 14 22:51:07 CET 2010

Ralf Schmitt wrote:
> "M.-A. Lemburg" <mal at egenix.com> writes:
>> 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
> You don't even know that you're going to run python. I have 40 python
> scripts in my /usr/bin directory. 
>> . 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.
> No, thanks. I'd rather setup my shell environment in ~/.zshrc, once.
>> If you just want to separate Python 2 and 3 files, use the
>> user site-packages dir which includes the Python version.
> Both the bzr and mercurial wiki recommend setting PYTHONPATH in order to
> install those programs in a user's home directory. There are still
> people running python <2.6.

Note that you only need to have a different PYTHONPATH
setups for Python 2.x/3.x if you plan to run code that:

 * is not installed in site-packages (most OS shipped code
   will be found in the resp. system site-packages/ dir)

 * is not installed in a user site-packages directory
   (user installed code will typically go there (*))

 * uses modules/packages that come in two different versions
   (one for Python 2.x and one for 3.x) and use the same name
   for both versions

 * needs to work in both Python 2.x and 3.x

(*) The method for installing code in user site-packages dir is

    python setup.py install --user

instead of the standard

    python setup.py install

which install to the system-wide site-packages.

BTW: I guess the bzr and mercurial wikis will need to be updated
accordingly - at least for users of Python >=2.6.

Marc-Andre Lemburg

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

More information about the Python-Dev mailing list