source: trunk/essentials/dev-lang/python/README@ 3368

Last change on this file since 3368 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 54.1 KB
Line 
1This is Python version 2.5
2==========================
3
4Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation.
5All rights reserved.
6
7Copyright (c) 2000 BeOpen.com.
8All rights reserved.
9
10Copyright (c) 1995-2001 Corporation for National Research Initiatives.
11All rights reserved.
12
13Copyright (c) 1991-1995 Stichting Mathematisch Centrum.
14All rights reserved.
15
16
17License information
18-------------------
19
20See the file "LICENSE" for information on the history of this
21software, terms & conditions for usage, and a DISCLAIMER OF ALL
22WARRANTIES.
23
24This Python distribution contains no GNU General Public Licensed
25(GPLed) code so it may be used in proprietary projects just like prior
26Python distributions. There are interfaces to some GNU code but these
27are entirely optional.
28
29All trademarks referenced herein are property of their respective
30holders.
31
32
33What's new in this release?
34---------------------------
35
36See the file "Misc/NEWS".
37
38
39If you don't read instructions
40------------------------------
41
42Congratulations on getting this far. :-)
43
44To start building right away (on UNIX): type "./configure" in the
45current directory and when it finishes, type "make". This creates an
46executable "./python"; to install in /usr/local, first do "su root"
47and then "make install".
48
49The section `Build instructions' below is still recommended reading.
50
51
52What is Python anyway?
53----------------------
54
55Python is an interpreted, interactive object-oriented programming
56language suitable (amongst other uses) for distributed application
57development, scripting, numeric computing and system testing. Python
58is often compared to Tcl, Perl, Java, JavaScript, Visual Basic or
59Scheme. To find out more about what Python can do for you, point your
60browser to http://www.python.org/.
61
62
63How do I learn Python?
64----------------------
65
66The official tutorial is still a good place to start; see
67http://docs.python.org/ for online and downloadable versions, as well
68as a list of other introductions, and reference documentation.
69
70There's a quickly growing set of books on Python. See
71http://wiki.python.org/moin/PythonBooks for a list.
72
73
74Documentation
75-------------
76
77All documentation is provided online in a variety of formats. In
78order of importance for new users: Tutorial, Library Reference,
79Language Reference, Extending & Embedding, and the Python/C API. The
80Library Reference is especially of immense value since much of
81Python's power is described there, including the built-in data types
82and functions!
83
84All documentation is also available online at the Python web site
85(http://docs.python.org/, see below). It is available online for
86occasional reference, or can be downloaded in many formats for faster
87access. The documentation is available in HTML, PostScript, PDF, and
88LaTeX formats; the LaTeX version is primarily for documentation
89authors, translators, and people with special formatting requirements.
90
91Unfortunately, new-style classes (new in Python 2.2) have not yet been
92integrated into Python's standard documentation. A collection of
93pointers to what has been written is at:
94
95 http://www.python.org/doc/newstyle.html
96
97
98Web sites
99---------
100
101New Python releases and related technologies are published at
102http://www.python.org/. Come visit us!
103
104There's also a Python community web site at
105http://starship.python.net/.
106
107
108Newsgroups and Mailing Lists
109----------------------------
110
111Read comp.lang.python, a high-volume discussion newsgroup about
112Python, or comp.lang.python.announce, a low-volume moderated newsgroup
113for Python-related announcements. These are also accessible as
114mailing lists: see http://www.python.org/community/lists.html for an
115overview of these and many other Python-related mailing lists.
116
117Archives are accessible via the Google Groups Usenet archive; see
118http://groups.google.com/. The mailing lists are also archived, see
119http://www.python.org/community/lists.html for details.
120
121
122Bug reports
123-----------
124
125To report or search for bugs, please use the Python Bug
126Tracker at http://sourceforge.net/bugs/?group_id=5470.
127
128
129Patches and contributions
130-------------------------
131
132To submit a patch or other contribution, please use the Python Patch
133Manager at http://sourceforge.net/patch/?group_id=5470. Guidelines
134for patch submission may be found at http://www.python.org/patches/.
135
136If you have a proposal to change Python, it's best to submit a Python
137Enhancement Proposal (PEP) first. All current PEPs, as well as
138guidelines for submitting a new PEP, are listed at
139http://www.python.org/peps/.
140
141
142Questions
143---------
144
145For help, if you can't find it in the manuals or on the web site, it's
146best to post to the comp.lang.python or the Python mailing list (see
147above). If you specifically don't want to involve the newsgroup or
148mailing list, send questions to [email protected] (a group of volunteers
149who answer questions as they can). The newsgroup is the most
150efficient way to ask public questions.
151
152
153Build instructions
154==================
155
156Before you can build Python, you must first configure it.
157Fortunately, the configuration and build process has been automated
158for Unix and Linux installations, so all you usually have to do is
159type a few commands and sit back. There are some platforms where
160things are not quite as smooth; see the platform specific notes below.
161If you want to build for multiple platforms sharing the same source
162tree, see the section on VPATH below.
163
164Start by running the script "./configure", which determines your
165system configuration and creates the Makefile. (It takes a minute or
166two -- please be patient!) You may want to pass options to the
167configure script -- see the section below on configuration options and
168variables. When it's done, you are ready to run make.
169
170To build Python, you normally type "make" in the toplevel directory.
171If you have changed the configuration, the Makefile may have to be
172rebuilt. In this case you may have to run make again to correctly
173build your desired target. The interpreter executable is built in the
174top level directory.
175
176Once you have built a Python interpreter, see the subsections below on
177testing and installation. If you run into trouble, see the next
178section.
179
180Previous versions of Python used a manual configuration process that
181involved editing the file Modules/Setup. While this file still exists
182and manual configuration is still supported, it is rarely needed any
183more: almost all modules are automatically built as appropriate under
184guidance of the setup.py script, which is run by Make after the
185interpreter has been built.
186
187
188Troubleshooting
189---------------
190
191See also the platform specific notes in the next section.
192
193If you run into other trouble, see the FAQ
194(http://www.python.org/doc/faq) for hints on what can go wrong, and
195how to fix it.
196
197If you rerun the configure script with different options, remove all
198object files by running "make clean" before rebuilding. Believe it or
199not, "make clean" sometimes helps to clean up other inexplicable
200problems as well. Try it before sending in a bug report!
201
202If the configure script fails or doesn't seem to find things that
203should be there, inspect the config.log file.
204
205If you get a warning for every file about the -Olimit option being no
206longer supported, you can ignore it. There's no foolproof way to know
207whether this option is needed; all we can do is test whether it is
208accepted without error. On some systems, e.g. older SGI compilers, it
209is essential for performance (specifically when compiling ceval.c,
210which has more basic blocks than the default limit of 1000). If the
211warning bothers you, edit the Makefile to remove "-Olimit 1500" from
212the OPT variable.
213
214If you get failures in test_long, or sys.maxint gets set to -1, you
215are probably experiencing compiler bugs, usually related to
216optimization. This is a common problem with some versions of gcc, and
217some vendor-supplied compilers, which can sometimes be worked around
218by turning off optimization. Consider switching to stable versions
219(gcc 2.95.2, gcc 3.x, or contact your vendor.)
220
221From Python 2.0 onward, all Python C code is ANSI C. Compiling using
222old K&R-C-only compilers is no longer possible. ANSI C compilers are
223available for all modern systems, either in the form of updated
224compilers from the vendor, or one of the free compilers (gcc).
225
226Unsupported systems
227-------------------
228
229A number of features are not supported in Python 2.5 anymore. Some
230support code is still present, but will be removed in Python 2.6.
231If you still need to use current Python versions on these systems,
232please send a message to [email protected] indicating that you
233volunteer to support this system. For a more detailed discussion
234regarding no-longer-supported and resupporting platforms, as well
235as a list of platforms that became or will be unsupported, see PEP 11.
236
237More specifically, the following systems are not supported any
238longer:
239- SunOS 4
240- DYNIX
241- dgux
242- Minix
243- NeXT
244- Irix 4 and --with-sgi-dl
245- Linux 1
246- Systems defining __d6_pthread_create (configure.in)
247- Systems defining PY_PTHREAD_D4, PY_PTHREAD_D6,
248 or PY_PTHREAD_D7 in thread_pthread.h
249- Systems using --with-dl-dld
250- Systems using --without-universal-newlines
251- MacOS 9
252
253The following systems are still supported in Python 2.5, but
254support will be dropped in 2.6:
255- Systems using --with-wctype-functions
256- Win9x, WinME
257
258Warning on install in Windows 98 and Windows Me
259-----------------------------------------------
260
261Following Microsoft's closing of Extended Support for
262Windows 98/ME (July 11, 2006), Python 2.6 will stop
263supporting these platforms. Python development and
264maintainability becomes easier (and more reliable) when
265platform specific code targeting OSes with few users
266and no dedicated expert developers is taken out. The
267vendor also warns that the OS versions listed above
268"can expose customers to security risks" and recommends
269upgrade.
270
271Platform specific notes
272-----------------------
273
274(Some of these may no longer apply. If you find you can build Python
275on these platforms without the special directions mentioned here,
276submit a documentation bug report to SourceForge (see Bug Reports
277above) so we can remove them!)
278
279GCC 4.1,
280GCC 4.2: There is a known incompatibility between Python and GCC,
281 where GCC 4.1 and later uses an interpretation of C
282 different to earlier GCC releases in an area where the C
283 specification has undefined behaviour (namely, integer arithmetic
284 involving -sys.maxint-1).
285
286 As a consequence, compiling Python with GCC 4.1/4.2 is not
287 recommended. It is likely that this problem will be resolved
288 in future Python releases. As a work-around, it seems that
289 adding -fwrapv to the compiler options restores the earlier
290 GCC behaviour.
291
292Unix platforms: If your vendor still ships (and you still use) Berkeley DB
293 1.85 you will need to edit Modules/Setup to build the bsddb185
294 module and add a line to sitecustomize.py which makes it the
295 default. In Modules/Setup a line like
296
297 bsddb185 bsddbmodule.c
298
299 should work. (You may need to add -I, -L or -l flags to direct the
300 compiler and linker to your include files and libraries.)
301
302XXX I think this next bit is out of date:
303
30464-bit platforms: The modules audioop, imageop and rgbimg don't work.
305 The setup.py script disables them on 64-bit installations.
306 Don't try to enable them in the Modules/Setup file. They
307 contain code that is quite wordsize sensitive. (If you have a
308 fix, let us know!)
309
310Solaris: When using Sun's C compiler with threads, at least on Solaris
311 2.5.1, you need to add the "-mt" compiler option (the simplest
312 way is probably to specify the compiler with this option as
313 the "CC" environment variable when running the configure
314 script).
315
316 When using GCC on Solaris, beware of binutils 2.13 or GCC
317 versions built using it. This mistakenly enables the
318 -zcombreloc option which creates broken shared libraries on
319 Solaris. binutils 2.12 works, and the binutils maintainers
320 are aware of the problem. Binutils 2.13.1 only partially
321 fixed things. It appears that 2.13.2 solves the problem
322 completely. This problem is known to occur with Solaris 2.7
323 and 2.8, but may also affect earlier and later versions of the
324 OS.
325
326 When the dynamic loader complains about errors finding shared
327 libraries, such as
328
329 ld.so.1: ./python: fatal: libstdc++.so.5: open failed:
330 No such file or directory
331
332 you need to first make sure that the library is available on
333 your system. Then, you need to instruct the dynamic loader how
334 to find it. You can choose any of the following strategies:
335
336 1. When compiling Python, set LD_RUN_PATH to the directories
337 containing missing libraries.
338 2. When running Python, set LD_LIBRARY_PATH to these directories.
339 3. Use crle(8) to extend the search path of the loader.
340 4. Modify the installed GCC specs file, adding -R options into the
341 *link: section.
342
343 The complex object fails to compile on Solaris 10 with gcc 3.4 (at
344 least up to 3.4.3). To work around it, define Py_HUGE_VAL as
345 HUGE_VAL(), e.g.:
346
347 make CPPFLAGS='-D"Py_HUGE_VAL=HUGE_VAL()" -I. -I$(srcdir)/Include'
348 ./python setup.py CPPFLAGS='-D"Py_HUGE_VAL=HUGE_VAL()"'
349
350Linux: A problem with threads and fork() was tracked down to a bug in
351 the pthreads code in glibc version 2.0.5; glibc version 2.0.7
352 solves the problem. This causes the popen2 test to fail;
353 problem and solution reported by Pablo Bleyer.
354
355Red Hat Linux: Red Hat 9 built Python2.2 in UCS-4 mode and hacked
356 Tcl to support it. To compile Python2.3 with Tkinter, you will
357 need to pass --enable-unicode=ucs4 flag to ./configure.
358
359 There's an executable /usr/bin/python which is Python
360 1.5.2 on most older Red Hat installations; several key Red Hat tools
361 require this version. Python 2.1.x may be installed as
362 /usr/bin/python2. The Makefile installs Python as
363 /usr/local/bin/python, which may or may not take precedence
364 over /usr/bin/python, depending on how you have set up $PATH.
365
366FreeBSD 3.x and probably platforms with NCurses that use libmytinfo or
367 similar: When using cursesmodule, the linking is not done in
368 the correct order with the defaults. Remove "-ltermcap" from
369 the readline entry in Setup, and use as curses entry: "curses
370 cursesmodule.c -lmytinfo -lncurses -ltermcap" - "mytinfo" (so
371 called on FreeBSD) should be the name of the auxiliary library
372 required on your platform. Normally, it would be linked
373 automatically, but not necessarily in the correct order.
374
375BSDI: BSDI versions before 4.1 have known problems with threads,
376 which can cause strange errors in a number of modules (for
377 instance, the 'test_signal' test script will hang forever.)
378 Turning off threads (with --with-threads=no) or upgrading to
379 BSDI 4.1 solves this problem.
380
381DEC Unix: Run configure with --with-dec-threads, or with
382 --with-threads=no if no threads are desired (threads are on by
383 default). When using GCC, it is possible to get an internal
384 compiler error if optimization is used. This was reported for
385 GCC 2.7.2.3 on selectmodule.c. Manually compile the affected
386 file without optimization to solve the problem.
387
388DEC Ultrix: compile with GCC to avoid bugs in the native compiler,
389 and pass SHELL=/bin/sh5 to Make when installing.
390
391AIX: A complete overhaul of the shared library support is now in
392 place. See Misc/AIX-NOTES for some notes on how it's done.
393 (The optimizer bug reported at this place in previous releases
394 has been worked around by a minimal code change.) If you get
395 errors about pthread_* functions, during compile or during
396 testing, try setting CC to a thread-safe (reentrant) compiler,
397 like "cc_r". For full C++ module support, set CC="xlC_r" (or
398 CC="xlC" without thread support).
399
400AIX 5.3: To build a 64-bit version with IBM's compiler, I used the
401 following:
402
403 export PATH=/usr/bin:/usr/vacpp/bin
404 ./configure --with-gcc="xlc_r -q64" --with-cxx="xlC_r -q64" \
405 --disable-ipv6 AR="ar -X64"
406 make
407
408HP-UX: When using threading, you may have to add -D_REENTRANT to the
409 OPT variable in the top-level Makefile; reported by Pat Knight,
410 this seems to make a difference (at least for HP-UX 10.20)
411 even though pyconfig.h defines it. This seems unnecessary when
412 using HP/UX 11 and later - threading seems to work "out of the
413 box".
414
415HP-UX ia64: When building on the ia64 (Itanium) platform using HP's
416 compiler, some experience has shown that the compiler's
417 optimiser produces a completely broken version of python
418 (see http://www.python.org/sf/814976). To work around this,
419 edit the Makefile and remove -O from the OPT line.
420
421 To build a 64-bit executable on an Itanium 2 system using HP's
422 compiler, use these environment variables:
423
424 CC=cc
425 CXX=aCC
426 BASECFLAGS="+DD64"
427 LDFLAGS="+DD64 -lxnet"
428
429 and call configure as:
430
431 ./configure --without-gcc
432
433 then *unset* the environment variables again before running
434 make. (At least one of these flags causes the build to fail
435 if it remains set.) You still have to edit the Makefile and
436 remove -O from the OPT line.
437
438HP PA-RISC 2.0: A recent bug report (http://www.python.org/sf/546117)
439 suggests that the C compiler in this 64-bit system has bugs
440 in the optimizer that break Python. Compiling without
441 optimization solves the problems.
442
443SCO: The following apply to SCO 3 only; Python builds out of the box
444 on SCO 5 (or so we've heard).
445
446 1) Everything works much better if you add -U__STDC__ to the
447 defs. This is because all the SCO header files are broken.
448 Anything that isn't mentioned in the C standard is
449 conditionally excluded when __STDC__ is defined.
450
451 2) Due to the U.S. export restrictions, SCO broke the crypt
452 stuff out into a separate library, libcrypt_i.a so the LIBS
453 needed be set to:
454
455 LIBS=' -lsocket -lcrypt_i'
456
457UnixWare: There are known bugs in the math library of the system, as well as
458 problems in the handling of threads (calling fork in one
459 thread may interrupt system calls in others). Therefore, test_math and
460 tests involving threads will fail until those problems are fixed.
461
462QNX: Chris Herborth ([email protected]) writes:
463 configure works best if you use GNU bash; a port is available on
464 ftp.qnx.com in /usr/free. I used the following process to build,
465 test and install Python 1.5.x under QNX:
466
467 1) CONFIG_SHELL=/usr/local/bin/bash CC=cc RANLIB=: \
468 ./configure --verbose --without-gcc --with-libm=""
469
470 2) edit Modules/Setup to activate everything that makes sense for
471 your system... tested here at QNX with the following modules:
472
473 array, audioop, binascii, cPickle, cStringIO, cmath,