Greetings,

The purpose of this communique is to document a process for installing python2.7.1 in parallel with python3.2 on a concurrent desktop with independent idle and python path structure.

Each version (python2, python3) will be installed in a separate python shell (idle) run on a separate local install so that both versions are running side-by-side on the same user desktop, each python shell having a unique .idlerc(v) configuration dir for look&feel as well as separate recent files lists and separate working .py folders.

Neither of the installs should affect the other installation (nor idle operation), nor should the installs affect the system-wide default install (python2.6.2 in my case running ubuntu 9.04 jaunty). As well, the search paths should not overlap except at the top $HOME level. The over-all purpose is to be able to play with both versions together in order to facilitate/enable/solve concurrent development, migration, and debug issues between the two versions.

I trust that if the community has already solved this problem, and has a better way, that I may discover it and be able to adopt it to my own environment as well.

    If you find any mistakes, please let me know.

            Best regards, m harris.

    The primary unordered issues for solution(s) are:

    1) separate PythonX folders for .py files, $HOME/PythonX
    2) separate desktop launchers to cleanly launch idleX for pythonX
    3) separate .idlercX files in the home dir for IDLE pythonX
    4) separate correct $HOME/local/pythonX installation folders
    5) separate correct $HOME/bin/ launch scripts and sym links
    6) Config from sources with correct --prefix setting
    7) Local Build & Install

===========================================================
BUILD VERSIONS FROM SOURCE
===========================================================
    Download the 2.7.1 and 3.2 tarballs from here:

    http://www.python.org/download/

    From your $HOME directory create the modules (.py) folder with:

        mkdir Python3             ie.,  $HOME/Python3/

    .... and then create the local installation folder in $HOME/local:

        mkdir local
        cd local
        mkdir python3             ie.,  $HOME/local/python3/

    Create a $HOME/bin/ folder, if it does not already exist.

    Unpack each tarball in $HOME with:

        tar -xvf Python-3.2.tar.bz2 --bzip2

    cd Python-3.2    and then build & install with:

        ./configure --prefix=$HOME/local/python3
        make
        make install

NOTES: Repeat these steps for each local version. It is important that the development headers already be installed, including the tk-dev package so that tkinter mod will get built enabling idle. The tarballs are available in several compression schemes... I chose bzip2. The --prefix option tells the installer where pythonX will live; this will be a local install visible only to the development user.

===========================================================
Symbolic link(s)
===========================================================

    Create a symbolic link for python in $HOME/bin/ with:

    cd $HOME/bin/
    ln -sf $HOME/local/python3/bin/python3 python3

    note:  (python3 can now be invoked from a linux terminal)

           Repeat the steps for each version.

           You may need to set your linux path to include
           $HOME/bin/  in either .profile or .bashrc if not
           already in place. This is usually already set on
           most modern linux distros if ~/bin/ exists.

===========================================================
Launcher Scripts
===========================================================

    Create the bash launcher script used for setting the
    PYTHONPATH and starting the python3 script. Use a text
    editor of your choice to create a text file in $HOME/bin/
    called  Python3-IDE  containing these three lines:

#!/bin/sh
export PYTHONPATH=$HOME/Python3
exec $HOME/bin/idle-python3 -n

    Now, create the python script for importing and launching
    the PyShell from idlelib; use a text editor to create a
    text file in $HOME/bin/ called  idle-python3  containing:

#!/home/<username>/bin/python3

from idlelib.PyShell import main
if __name__ == '__main__':
    main()

    The first line /home/<username>/ is $HOME, but may have to
    be spelled out in the script above. Now, set both scripts
    executeable with:

        chmod 0754 $HOME/bin/Python3-IDE
        chmod 0754 $HOME/bin/idle-python3

    Notes:  Repeat for each version. Summary; each version will
    have its own launcher script ( PythonX-IDE ) and each will
    have its own python idle starter script ( idle-pythonX ).

    The launcher script is the 'called' file from the Desktop
    launcher icon, which sets the PYTHONPATH. The python idle
    starter script correctly starts the interpreter and then
    initiates the PyShell (python idle shell) import main and
    run.

===========================================================
IDLE Configuration File   .idlrcX
===========================================================

    By default the  idlelib.configHandler  sets the config
    dir to  $HOME/.idlerc   (we will change this so that
    each idle version will have its own config directory
    in $HOME).  The cfgDir attribute is held in the config
    handler in the following module hierarchy:

[module] idlelib.configHandler

    Class IdleConf

        def GetUserCfgDir()

            cfgDir='.idlerc'

    Use a text editor and "carefully" change the config
    handler located here:

        $HOME/local/python3/lib/python3.2/idlelib/configHandler.py

    (you might want to backup the configHandler.py file just in
     case you honk it somehow...    )         :-)

    Find the Class IdleConf and then locate the def called:
        GetUserCfgDir()

    Change the attribute cfgDir to:
        cfgDir='.idlerc3'

    Save the file.

    Notes:  Repeat for each version.  Summary, each version will
    have its own .idlercX configuration file:

        .idlerc3
        .idlerc2

    Also, the default python installation will still have its own
    configuration file  .idlerc  specific to the system-wide IDLE
    config.

===========================================================
Construct Desktop Launchers
===========================================================

    Build each Desktop python application launcher in the
    usual way, and point the lancher to  $HOME/bin/Python3-IDE

    Repeat this step for each version application launcher.

===========================================================
DONE   enjoy a cup of tea
===========================================================

At this point you should be able to launch each python version in its own python shell from the Desktop and have them both running concurrently side-by-side without stepping on one anothers toes, as it were, and each having its own environment look & feel.

I actually set one of the shells to have differing colors and font so that I can visually remember which environment I'm coding to. Also, I keep my python3.py files only in Python3 and my python2.py files only in Python2. In this way they can have the same names exactly but because the path structures are completely isolated the correct .py is imported depending on the version environment.

    Kind regards,

    m harris
Greetings,

    The purpose of this communique is to document a process for installing 
python2.7.1 in parallel with python3.2 on a concurrent desktop with independent 
idle and python path structure.

    Each version (python2, python3) will be installed in a separate python 
shell (idle) run on a separate local install so that both versions are running 
side-by-side on the same user desktop, each python shell having a unique 
.idlerc(v) configuration dir for look&feel as well as separate recent files 
lists and separate working .py folders.

    Neither of the installs should affect the other installation (nor idle 
operation), nor should the installs affect the system-wide default install 
(python2.6.2 in my case running ubuntu 9.04 jaunty). As well, the search paths 
should not overlap except at the top $HOME level. The over-all purpose is to be 
able to play with both versions together in order to facilitate/enable/solve 
concurrent development, migration, and debug issues between the two versions.

    I trust that if the community has already solved this problem, and has a 
better way, that I may discover it and be able to adopt it to my own 
environment as well.     

    If you find any mistakes, please let me know.

            Best regards, m harris.

    The primary unordered issues for solution(s) are:

    1) separate PythonX folders for .py files, $HOME/PythonX 
    2) separate desktop launchers to cleanly launch idleX for pythonX
    3) separate .idlercX files in the home dir for IDLE pythonX
    4) separate correct $HOME/local/pythonX installation folders
    5) separate correct $HOME/bin/ launch scripts and sym links
    6) Config from sources with correct --prefix setting
    7) Local Build & Install

===========================================================
BUILD VERSIONS FROM SOURCE
===========================================================
    Download the 2.7.1 and 3.2 tarballs from here:

    http://www.python.org/download/

    From your $HOME directory create the modules (.py) folder with:

        mkdir Python3             ie.,  $HOME/Python3/

    .... and then create the local installation folder in $HOME/local:

        mkdir local
        cd local
        mkdir python3             ie.,  $HOME/local/python3/

    Create a $HOME/bin/ folder, if it does not already exist.

    Unpack each tarball in $HOME with:

        tar -xvf Python-3.2.tar.bz2 --bzip2

    cd Python-3.2    and then build & install with:

        ./configure --prefix=$HOME/local/python3
        make
        make install

    NOTES:  Repeat these steps for each local version. It is important that the 
development headers already be installed, including the tk-dev package so that 
tkinter mod will get built enabling idle. The tarballs are available in several 
compression schemes... I chose bzip2. 
    The --prefix option tells the installer where pythonX will live; this will 
be a local install visible only to the development user.

===========================================================
Symbolic link(s)
===========================================================

    Create a symbolic link for python in $HOME/bin/ with:

    cd $HOME/bin/
    ln -sf $HOME/local/python3/bin/python3 python3

    note:  (python3 can now be invoked from a linux terminal)

           Repeat the steps for each version.

           You may need to set your linux path to include
           $HOME/bin/  in either .profile or .bashrc if not
           already in place. This is usually already set on
           most modern linux distros if ~/bin/ exists.

===========================================================
Launcher Scripts
===========================================================

    Create the bash launcher script used for setting the 
    PYTHONPATH and starting the python3 script. Use a text
    editor of your choice to create a text file in $HOME/bin/
    called  Python3-IDE  containing these three lines:

#!/bin/sh
export PYTHONPATH=$HOME/Python3
exec $HOME/bin/idle-python3 -n

    Now, create the python script for importing and launching 
    the PyShell from idlelib; use a text editor to create a
    text file in $HOME/bin/ called  idle-python3  containing:

#!/home/<username>/bin/python3

from idlelib.PyShell import main
if __name__ == '__main__':
    main()

    The first line /home/<username>/ is $HOME, but may have to 
    be spelled out in the script above. Now, set both scripts 
    executeable with:

        chmod 0754 $HOME/bin/Python3-IDE
        chmod 0754 $HOME/bin/idle-python3

    Notes:  Repeat for each version. Summary; each version will
    have its own launcher script ( PythonX-IDE ) and each will 
    have its own python idle starter script ( idle-pythonX ). 

    The launcher script is the 'called' file from the Desktop 
    launcher icon, which sets the PYTHONPATH. The python idle 
    starter script correctly starts the interpreter and then 
    initiates the PyShell (python idle shell) import main and
    run. 

===========================================================
IDLE Configuration File   .idlrcX  
===========================================================

    By default the  idlelib.configHandler  sets the config
    dir to  $HOME/.idlerc   (we will change this so that 
    each idle version will have its own config directory 
    in $HOME).  The cfgDir attribute is held in the config
    handler in the following module hierarchy:

[module] idlelib.configHandler

    Class IdleConf

        def GetUserCfgDir()

            cfgDir='.idlerc'

    Use a text editor and "carefully" change the config 
    handler located here:

        $HOME/local/python3/lib/python3.2/idlelib/configHandler.py

    (you might want to backup the configHandler.py file just in
     case you honk it somehow...    )         :-)

    Find the Class IdleConf and then locate the def called:
        GetUserCfgDir()

    Change the attribute cfgDir to:
        cfgDir='.idlerc3'

    Save the file.

    Notes:  Repeat for each version.  Summary, each version will 
    have its own .idlercX configuration file:

        .idlerc3
        .idlerc2

    Also, the default python installation will still have its own
    configuration file  .idlerc  specific to the system-wide IDLE
    config.  

===========================================================
Construct Desktop Launchers
===========================================================

    Build each Desktop python application launcher in the 
    usual way, and point the lancher to  $HOME/bin/Python3-IDE

    Repeat this step for each version application launcher.

===========================================================
DONE   enjoy a cup of tea
===========================================================

    At this point you should be able to launch each python version in its own 
python shell from the Desktop and have them both running concurrently 
side-by-side without stepping on one anothers toes, as it were, and each having 
its own environment look & feel.

    I actually set one of the shells to have differing colors and font so that 
I can visually remember which environment I'm coding to. Also, I keep my 
python3.py files only in Python3 and my python2.py files only in Python2. In 
this way they can have the same names exactly but because the path structures 
are completely isolated the correct .py is imported depending on the version 
environment. 

    Kind regards,

    m harris





-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to