-   Slackware (
-   -   Python 2 and 3 install (

fatalerror0x00 12-28-2012 02:47 PM

Python 2 and 3 install
How can I get python 3 installed but without ruining my python 2 scripts that come with Slackware if any or are used in any of my programs I've added. I don't think there are any but I can't be the one to say that cause likely there is. I just I want to use python 3 but the system has python 2 so how can I install both without ruining either isntallation?

ponce 12-28-2012 02:54 PM

use the python3 slackbuild from

it's safely parallel installable with the stock python of slackware: the interpreter will be called python3 so it won't conflict with python (the one of the 2.7.x version).

be aware that python-2.7.x and python-3.3.x have different folders where they store their modules, /usr/lib$LIBDIRSUFFIX/python2.7 and /usr/lib$LIBDIRSUFFIX/python3.3: if you, by any chance, will install any third party module, it will be built/installed/available only for one of the two versions of pyhton, most probably the 2.7.x one as /usr/bin/python will be found...

fatalerror0x00 12-28-2012 03:39 PM

Thank you didn't know that but now I have the question of if I install pygame which I might I'm not sure it's unlikely but say I do. How could I get it installed for python3? other then that great job :)

ponce 12-29-2012 12:17 AM

you will need a new dedicated pygame3.SlackBuild for different reasons:
- /usr/bin/python3 must be launched in place of /usr/bin/python for the configure and setup phase of the python module;
- some python modules are still incompatible with python-3.x: luckily, in this case, the version in pygame's mercurial, beside being still at alpha stage, is given for compatible with python-3.x, so we have to use a snapshot of that;
- as it's dedicated to python3 and installs different stuff in different places from the one for python-2.x, the slackbuild should be renamed with a 3 at the end (and the various files adapted accordingly);

see the differences with the script for python-2.x

MadMaverick9 01-19-2013 10:55 PM

Whilst python keeps itself nicely separated ...

How do you deal with the issue that other python packages, like pygobject, don't keep themselves neatly separated? pygobject for example puts addtl. files in "/usr/include/pygtk-2.0/" ("usr/include/pygtk-2.0/pygobject.h"). How do you prevent pygobject from overwriting files that belong to a pygobject install for python 2?

Same question applies to wxPython and others. Because they all add files into directories like "/usr/include/" etc. which are not python version specific.

Why doesn't wxPython add its include files to "/usr/include/python2.x/"?

How have you solved or worked around this issue?

TommyC7 01-19-2013 11:12 PM

Hi there MadMaverick9,

For me I install things like that into /opt as per the Filesystem Hierarchy Standard, so something like /opt/<package name>-<package version>/{lib,lib64,bin,share,...}, but you can also use /usr/local (which is already in the default $PATH anyways, so it might be easier for you).

MadMaverick9 01-20-2013 10:40 PM

Thanks for your reply TommyC7.

But my question was a pointless question as I just found out, since some packages like PyGTK don't even build with Python3. PyGTK uses some things like "dl_export" that have been deprecated since Python 2.3 and have been removed in Python 3.

So just forget that I asked.

All times are GMT -5. The time now is 06:07 AM.