472,805 Members | 1,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

HOWTO: Python 2.3 on Fedora Core 1 Linux

Several people asked me for the following HOWTO, so I decided to
post it here (though it is still very 'alpha' and might contain
many (?) mistakes; didn't test what I wrote, but wrote it - more
or less - during my own installation of Python 2.3 on Fedora Core 1
Linux for a friend of mine).

Anyway, HTH, L.

HOWTO: Install a separate Python 2.3.2 on Fedora Core 1 Linux without
removing the preinstalled Python 2.2.3 which is needed by many
of the Fedora/RedHat configuration scripts.
Table of Contents:

I. Some reasons for doing this

II. Warning

III. Dependencies

IV. About the 'new' Python

V. Installation
- Installing Tcl/Tk 8.4
- Installing Python 2.3.2 (final)
- Installing the libxml2/libxslt Python bindings
- Installing PyGTK (Python bindings for GTK+ 2.x)
- Installing wxPython with wxGTK (Python bindings for wxWindows)

VI. Test the Installation

Appendix A: Python Installation with Tkinter - edit: Modules/Setup.dist

================================================== =======================

I. Some reasons for doing this:

(1) You want to use Python 2.3.
(2) Python 2.2 (as preinstalled by Fedora) is a mess; e.g. Tkinter
(as provided by Fedora) does not work (UCS-2/UCS-4 problem with
Python - Tkinter - Tcl/Tk).
(3) Python 2.2 (as preinstalled by Fedora) uses a lot of 3rd party
packages (s. /usr/lib/python2.2/site-packages). Installing newer
or older (sometimes necessary) versions of these packages can cause
trouble with the Fedora/RedHat configuration scripts. Some other 3rd
party packages might also have or cause problems with one or more of
the preinstalled packages (e.g. XML stuff).
(4) You want to know exactly what kind of Python (compiler options) and
which 3rd party packages you are using.
(5) etc. etc. :-)

================================================== =======================

II. Warning:

Be aware that it is always risky to install new software; maybe you will
destroy your whole system, loose data etc. This document comes with no
warranty at all; following the instructions in this document is something
you have to do at your own risk!

Recommendation: don't follow the instructions in this document but read
the documentation which comes with the distributions which are described
in this document. (A good reason for doing this: installation procedures
are not written in stone but often change with new releases.)

================================================== =======================

III. Dependencies:

Since you will have to compile everything from source, you have to make
sure first that all the necessary RPMs for doing this are installed on
your system:

- gcc, gcc-c++ (C/C++ compiler)
- XFree86-devel
- libxml2(-devel), libxslt(-devel) if you want to use libxml2/libxslt
- ... (?)

Use 'rpm -qi ...' to check this.

================================================== =======================

IV. About the 'new' Python:

On Fedora, Python is installed in /usr/bin, /usr/lib etc. The same holds
e.g. for Tcl/Tk (which is needed by Tkinter) etc. etc.

So what you can do is: install the new Python (and related stuff) in the
/usr/local/bin, /usr/local/lib etc. branch.

The only problem is that you will end up with two 'python' commands (one
in /usr/bin for Fedora's Python 2.2 and one in /usr/local/bin for the new
Python 2.3). You have to delete the one in /usr/local/bin and use a tiny
start-up script 'py' instead (s. further below).

================================================== =======================

V. Installation:
Installing Tcl/Tk 8.4:
----------------------

Fedora Core 1 comes with Tcl/Tk 8.3 (actually: 8.3.5). If you want to use
Tkinter with your new python, I recommend to install Tcl/Tk 8.4 first (in
the /usr/local branch, where everything related to the new Python goes).

tarballs: tcl8.4.4-src.tar.gz, tk8.4.4-src.tar.gz

- get the above tarballs from http://www.tcl.tk and untar them with
'tar -xzf tcl8.4.4-src.tar.gz' resp. 'tar -xzf tk8.4.4-src.tar.gz'

- change (cd) to the 'unix' subdir of the newly created dir with the
Tcl distribution and do the usual:

./configure
make
make install

- change (cd) to the 'unix' subdir of the newly created dir with the
Tk distribution and do the usual:

./configure
make
make install

(The above will install Tcl/Tk in /usr/local/lib etc.)
Installing Python 2.3.2 (final)
-------------------------------

tarball: Python-2.3.2.tgz

- get the above tarball from http://www.python.org and untar it

- if you want to use Tkinter, edit the file 'Setup.dist' in the subdir
'Modules' of the newly created dir with the Python distribution (see
Appendix A for details)

- type:

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

(Otherwise, lbitk8.4.so in /usr/local/lib will not be found by 'make'.)

- type (in the newly created directory with the Python distribution):

./configure
make
make install

- remove (rm) /usr/local/bin/python

(Otherwise /usr/bin/python (Python 2.2!) will not work any more.)

- now you will need a start-up script for Python;
create a file /usr/local/bin/py with the following content:

#!/bin/bash
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
/usr/local/bin/python2.3 $1 $2 $3 $4 $5 $6 $7 $8 $9

(This is necessary, because Python - when invoked via 'python2.3' does
not find libtk8.4.so otherwise.)

(You could also use LD_LIBRARY_PATH permanently (not recommended), use
a symbolic link in /usr/lib or use 'ldconfig'; but the above solution
works as long as you start your Python scripts with 'py <script-name>'
and not via the shebang line #!/usr/bin/env python; (you can still use
the shebang line #!/usr/bin/env py).)
Installing the libxml2/libxslt Python bindings
----------------------------------------------

(This is clearly optional; I use them all the time, thus they are in
this document.)

tarball: libxml2-python-2.5.11.tar.gz

(The version must *exactly* match the version of the installed libxml2
library; check this with 'rpm -qi libxml2'.)

- get the above tarball from ftp://xmlsoft.org/python/ and untar it

- type (in the newly created directory with the libxml2 distribution):

py setup.py install

(Important: use 'py' here (and not 'pyhton'); otherwise the package
gets installed in the 'site-packages' subdir of Python 2.2 and not
in the 'site-packages' subdir of the new Python 2.3.)

(The installation will trigger a 'Deprecation' warning: "xmllib should
not be used anymore; use xml.sax instead"; simply ignore this.)
Installing PyGTK (Python bindings for GTK+ 2.x)
-----------------------------------------------

(This is clearly optional; I use it, thus it is in this document.)

tarball: pygtk-2.0.0.tar.gz

- get the tarball from ftp://ftp.gtk.org/pub/gtk/python/v2.0/
and untar it

- type:

PYTHON=/usr/local/bin/python2.3
export PYTHON

(Otherwise PyGTK goes into the 'site-packages' subdir of Python 2.2
and not in the 'site-packages' subdir of the new Python 2.3.)

- type (in the newly created subdir with the PyGTK distribution):
./configure
make
make install
Installing wxPython with wxGTK (Python bindings for wxWindows)
--------------------------------------------------------------

(This is clearly optional; I use it, thus it is in this document.)

tarball: wxPythonSrc-2.4.2.4.tar.gz

(s. furter below for optional tarballs with demos, documentation etc.)
- get the tarball from http://www.wxpython.org and untar it

- change (cd) to the newliy created directory with the wxPython
distribution

- type:

export WXPREF=/usr/local/lib/wxPython

- create a 'build' dir and use it; type:

mkdir build
cd build

- first, we have to install wxGTK, since wxPython uses GTK+ 2.x on Linux;
type (we use \ for 'line continuation'; type everything on one line):

../configure --with-gtk \
--prefix=$WXPREF \
--enable-rpath=$WXPREF/lib \
--with-opengl \
--enable-geometry \
--enable-optimise \
--enable-debug_flag \
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
--enable-gtk2 \
--enable-unicode \

(This will configure wxGTK for GTK 2.x with Unicode. Moreover, some
'builtin' image libraries are used and not the image libraries of
your system. See the file 'README.1st.txt' in the distribution for
further information.)

- type:

make
make install

- now we can install wxPython itself;
type (again, type everything on one line (without the '\')):

cd ../wxPython
py setup.py \
WX_CONFIG=$WXPREF/bin/wx-config \
WXPORT=gtk2 UNICODE=1 \
build install

(Use 'py' in the above; not 'python'! That will tell wxPython where
to install the package ('site-packages' of Python 2.3) and for which
version of Python to build for.)

- optionally (but highly recommended): install the wxPython demo (incl.
the samples) and the wxWindows documentation:

tarballs: wxPythonDemo-2.4.2.4.tar.gz, wxPythonDocs-2.4.2.4.tar.gz

- get the tarballs from http://www.wxpython.org and untar them
- move (mv) the subdirs of the newly created dir with the demo, samples
and docs to /usr/local/lib/wxPython

================================================== =======================

VI. Test the Installation

Open a new console (*not* as user root; old consoles might not find the
new commands etc. properly). Then try out the following:

- Python 2.2 still OK?

start a python shell with 'python'
the shell should tell you that you are running Python 2.2

(Under Linux, you can quit a python shell with 'Ctrl-d'.)

(You could also try to run one of the 'redhat-config-...'
scripts; (depends on which of these scripts are installed
on your system).)
- Python 2.3 OK?

start a python shell with 'py'
the shell should tell you that you are running Python 2.3
- libxml2/libxslt Python bindings OK?

start a python shell with 'py'

type: import libxml2
type: import libxslt

both should work without any errors or warnings
- Tkinter (Tcl/Tk) OK?

type: py /usr/local/lib/python2.3/lib-tk/Tkinter.py

a Tk window should open telling you that you are running Tk 8.4
- PyGTK OK?

run (with the 'py' command) any of the examples in the subdirs of:

/usr/share/doc/pygtk2-2.0.0/examples

(e.g.: py /usr/share/doc/pygtk2-2.0.0/examples/pygtk-demo/demos/menu.py
should pop up a window with menu examples)
- wxPython OK?

type: py /usr/local/lib/wxPython/demo/demo.py

this should start the wxPython demo

(
to view the wxWindows documentation, do the following:

type: cd /usr/local/lib/wxPython/docs/
py viewdocs.py
)

================================================== =======================

Appendix A:

Python Installation with Tkinter - edit: Modules/Setup.dist

The Modules/Setup.dist file must be modified in the following way:

# -- BEGINNING OF CHANGES --

# The _tkinter module.
#
# The command for _tkinter is long and site specific. Please
# uncomment and/or edit those parts as indicated. If you don't have a
# specific extension (e.g. Tix or BLT), leave the corresponding line
# commented out. (Leave the trailing backslashes in! If you
# experience strange errors, you may want to join all uncommented
# lines and remove the backslashes -- the backslash interpretation is
# done by the shell's "read" command and it may not be implemented on
# every system.

# *** Always uncomment this (leave the leading underscore in!):
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
-L/usr/local/lib \
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
-I/usr/local/include \
# *** Uncomment and edit to reflect where your X11 header files are:
-I/usr/X11R6/include \
# *** Or uncomment this for Solaris:
# -I/usr/openwin/include \
# *** Uncomment and edit for Tix extension only:
# -DWITH_TIX -ltix8.1.8.2 \
# *** Uncomment and edit for BLT extension only:
# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
# *** Uncomment and edit for PIL (TkImaging) extension only:
# (See http://www.pythonware.com/products/pil/ for more info)
# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
# *** Uncomment and edit for TOGL extension only:
# -DWITH_TOGL togl.c \
# *** Uncomment and edit to reflect your Tcl/Tk versions:
-ltk8.4 -ltcl8.4 \
# *** Uncomment and edit to reflect where your X11 libraries are:
-L/usr/X11R6/lib \
# *** Or uncomment this for Solaris:
# -L/usr/openwin/lib \
# *** Uncomment these for TOGL extension only:
# -lGL -lGLU -lXext -lXmu \
# *** Uncomment for AIX:
# -lld \
# *** Always uncomment this; X11 libraries to link with:
-lX11

# -- END OF CHANGES --
--
mailto: logan@phreaker(NoSpam).net

Jul 18 '05 #1
4 3721
Logan <lo***@phreaker.nospam> wrote in message news:<pa****************************@phreaker.nosp am>...
Several people asked me for the following HOWTO, so I decided to
post it here (though it is still very 'alpha' and might contain
many (?) mistakes; didn't test what I wrote, but wrote it - more
or less - during my own installation of Python 2.3 on Fedora Core 1
Linux for a friend of mine).


Thank you very much for this! (I've ordered Fedora CDs just yesterday ...)

Michele
Jul 18 '05 #2
On Wed, 26 Nov 2003 03:51:36 +0100, Logan wrote:

Installing wxPython with wxGTK (Python bindings for wxWindows)
... ... ...
../configure --with-gtk \
--prefix=$WXPREF \
--enable-rpath=$WXPREF/lib \
--with-opengl \
--enable-geometry \
--enable-optimise \
--enable-debug_flag \
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
--enable-gtk2 \
--enable-unicode \


There seems to be a problem with wxPython on Fedora Core 1 Linux,
if you install it as described above (s. main posting). E.g. when
right clicking on a TextCtrl, no popup-window appears but the
script crashes (seg fault).

(More on this: s. the mailing list for wxPython.)

To avoid this (i.e. the seg faults), use the following to
configure wxGTK (instead of the above):

../configure --prefix=$WXPREF \
--enable-rpath=$WXPREF/lib \
--with-opengl \
--enable-geometry \
--enable-optimise \
--enable-gtk2 \
--enable-unicode \

L.

--
mailto: logan@phreaker(NoSpam).net

Jul 18 '05 #3
b0x
hey, thx alot for this topic,i had so many problems in installing tkinter , google didnt help me this time, but your toipc did :0) ..
Jul 18 '05 #4
b0x
hey, thx alot for this topic,i had so many problems in installing tkinter , google didnt help me this time, but your toipc did :0) ..
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Thomas | last post by:
Python/Tk (Tkinter) does not work under Fedora Core 1; the problem seems to be, that the Python RPM package uses a Python which was compiled with the UCS4 option, whereas Tcl/Tk uses UCS2. My...
9
by: Nuff Said | last post by:
When I type the following code in the interactive python shell, I get 'UTF-8'; but if I put the code into a Python script and run the script - in the same terminal on my Linux box in which I...
3
by: Tim Gahnstrom | last post by:
rdiff-backup is aperently written in Python and when I run it in a special way I get some funy Python errors. Does anyone know if linux python have some issues with working with fat32 or usb...
7
by: Edward Diener | last post by:
I can install Python 2.4 on the Fedora 3 Linux system, but after I do a number of Linux utilities and commands, like yum, stop working because they were dependent on the Python 2.3 installation....
10
by: callmebill | last post by:
I'm getting my feet wet with making Python talk to MySQL via ODBC. I started on Windows, and it went smoothly enough due to the ODBC stuff that apparently is native to Python at least on windows...
12
by: Claudio Grondi | last post by:
I have just discovered the existance of Puppy Linux which is a complete operating system with a suite of GUI apps, only about 50 - 60M booting directly off the CDROM ( http://www.puppylinux.org...
15
by: John Nagle | last post by:
I've been installing Python and its supporting packages on a dedicated server with Fedora Core 6 for about a day now. This is a standard dedicated rackmount server in a colocation facility,...
5
Atli
by: Atli | last post by:
Hi guys. So, I got it into my head this morning that I needed a Linux HTTP server. Naturally that means installing Apache with PHP and last but not least, MySQL. I decided to use Fedora Code...
0
by: Matteo Bertini | last post by:
#### PyQt3Support - Python bindings for Qt3Support #### http://www.develer.com/oss/PyQt3Support #### What is this? PyQt3Support is an extension to PyQt4 that adds bindings to Qt's...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.