blob: 3bcc69d7013e24ffde824bf7113081ca502c0f96 [file] [log] [blame]
Jack Jansenb9526512001-12-27 23:01:18 +00001How to install Python 2.2 on your Macintosh
Jack Jansencbed91b2001-08-03 13:31:36 +00002---------------------------------------------
Jack Jansen2f9a9e32001-02-17 22:03:42 +00003
Jack Jansenc1218bc2001-04-25 22:11:24 +00004This is a MacPython that can run on classic MacOS (from 8.1
Jack Jansencbe7b1c2001-03-06 22:42:12 +00005onwards) and natively on MacOSX. The installer tries to work out whether you can
Jack Jansen6bc62c42001-12-20 20:41:45 +00006use the Carbon version or not. For Mac OS X users: this version of Python
7does not run from the command line, it is a pure "Mac only" app. Use the standard
8unix Python from the commandline, the two Pythons will be merged in the future.
Jack Jansen2f9a9e32001-02-17 22:03:42 +00009
Jack Jansen028f2d52001-08-29 22:04:08 +000010You should definitely read the Relnotes file too, and the section below about
Jack Jansen5d528b72001-10-23 22:22:09 +000011toolbox module reorganization. You should also read :Misc:NEWS, which lists
12the general (non-mac-dependent) new features of this Python release.
Jack Jansen2f9a9e32001-02-17 22:03:42 +000013
Jack Jansenc1218bc2001-04-25 22:11:24 +000014A special note about the active installer: do not background it, it may hang
Jack Jansen2b73fe92001-03-27 21:38:55 +000015your machine. This is a general problem with Vise active installers, MindVision
16are working on it.
Jack Jansen8ef786e2001-03-15 14:27:09 +000017
Jack Jansen2f9a9e32001-02-17 22:03:42 +000018------
Jack Jansen83cab721997-08-26 13:25:06 +000019
20If this is your first encounter with Python: you definitely need the
21common user documentation (common to all platforms). You can find this
Jack Jansen538bd132000-10-19 21:58:27 +000022(in various forms) on www.pythonlabs.com, www.python.org and
23ftp.python.org. Through there, or via
24http://www.cwi.nl/~jack/macpython.html you can also find the most recent
25MacPython distribution.
Jack Jansen83cab721997-08-26 13:25:06 +000026
27Mac-specific documentation is included in this distribution in folder
28Mac:Demo. The documentation is sparse, but it will have to serve for
29now. The documentation is in HTML format, start with index.html.
30
Jack Jansencbe7b1c2001-03-06 22:42:12 +000031This installer installs MacPython for classic PPC MacOS, MacPython for Carbon
Jack Jansenb9526512001-12-27 23:01:18 +000032(OS X, OS 9 or OS 8 with CarbonLib installed) or both, depending on your
Jack Jansencbe7b1c2001-03-06 22:42:12 +000033configuration. By selecting custom install you can bypass these tests and
34install what you want.
Jack Jansenecbc1cc1998-01-06 12:13:16 +000035
Jack Jansenb9526512001-12-27 23:01:18 +000036If you want 68k support you will have get MacPython 1.5.2.
Jack Jansen965226b2000-09-14 20:58:24 +000037
Jack Jansen028f2d52001-08-29 22:04:08 +000038Toolbox module reorganization and more
39--------------------------------------
40
41You can safely skip this section if this is your first encounter with MacPython.
42
Jack Jansenb9526512001-12-27 23:01:18 +000043This release has a new organization of the mac-specific modules, and in
44general brings the MacPython folder structure more in line with
Jack Jansen028f2d52001-08-29 22:04:08 +000045unix-Python. This is not only a good idea, it will also immensely
46facilitate moving MacPython functionality to an OSX Python that is based
47on Mach-O and the unix-Python distribution. But don't worry: MacPython
48is definitely not dead yet, and the hope is that the transition will be
49as seamless as possible.
50
51First a change that should not cause too much concern: :Mac:Plugins has
52gone, and most of the dynamically loaded modules have moved to
53:Lib:lib-dynload.
54
55Second, and more important: the toolbox modules, such as Res and
56Resource, have moved to a Carbon package. So, in stead of "import Res"
57you should now say "from Carbon import Res" and in stead of "from Res
58import *" you should use "from Carbon.Res import *". For the lifetime of
59MacPython 2.2 there is a folder :Mac:Lib:lib-compat on sys.path that
60contains modules with the old names which imports the new names after
61issuing a warning.
62
63Note that although the package is called Carbon the modules work fine under
64classic PPC, and they are normal classic modules. Also note that some
65modules you may think of as toolbox modules (such as Waste) really are not,
66and they are not in the Carbon package.
Jack Jansen6bc62c42001-12-20 20:41:45 +000067
68Also, all toolbox modules have been updated to Universal Headers 3.4, and
69are (for classic PPC) weak-linked against InterfaceLib so that they should
70work on all systems back to MacOS 8.1. Calling an unimplemented function will
71raise an exception, not crash your interpreter.
Jack Jansen028f2d52001-08-29 22:04:08 +000072
73Another change related to the OSX growth path is that there is a new module
74macresource that you can use to easily open a resource file accompanying your
75script. Use "macresource.need("DLOG", MY_DIALOG_ID, "name.rsrc") and if the
76given resource is not available (it _is_ available if your script has been
77turned into an applet) the given resource file will be opened. This method will
78eventually also contain the magic needed to open the resource file on
79OSX MachO Python.
80
Jack Jansen1a29ed72001-10-31 10:13:52 +000081Another feature to help with the OSX transition is that if you open a
82textfile for reading MacPython will now accept either unix linefeeds
83(LF, '\n') or Macintosh linefeeds (CR, '\r') and present both of them
84as '\n'. This is done on a low level, so it works for files opened by
85scripts as well as for your scripts and modules itself. This can be
86turned off with a preference/startup option.
Jack Jansen028f2d52001-08-29 22:04:08 +000087
88But:
89- this works only for input, and there's no way to find out what the original
90 linefeed convention of the file was.
Jack Jansen028f2d52001-08-29 22:04:08 +000091- Windows \r\n linefeeds are not supported and get turned into \n\n.
Jack Jansenb9526512001-12-27 23:01:18 +000092- in 2.3 this feature will be replaced by a more general, platform independent
93 way of handling files with foreign newline conventions.
Jack Jansen028f2d52001-08-29 22:04:08 +000094
Jack Jansen83cab721997-08-26 13:25:06 +000095What to install
96---------------
97
Jack Jansen12a37b72000-05-06 23:01:07 +000098The optional parts in this distribution are
Jack Jansen1a29ed72001-10-31 10:13:52 +000099- TK+PIL: Tkinter and support modules, plus Imaging, the Python image
100 manipulation package (allows you to read, write and display images and
101 do lots of operations on them).
Jack Jansencbe7b1c2001-03-06 22:42:12 +0000102 For Carbon MacPython you only get PIL: there is no Tcl/Tk for Carbon yet.
Jack Jansen1a29ed72001-10-31 10:13:52 +0000103 This is the reason Classic MacPython is also installed on MacOSX: it
104 allows you to run Tkinter applications, albeit in the Classic box.
Jack Jansen12a37b72000-05-06 23:01:07 +0000105- img: another imaging package. Has more file format support and is faster
106 than imaging, but has only limited operations on images. There is a bridge
107 between the packages.
108- Numeric: the LLNL Numeric Python extension. All sorts of nifty operations
Jack Jansen1a29ed72001-10-31 10:13:52 +0000109 on matrices and such. This is the most recent version from the
110 sourceforge archive.
111 Numeric has moved from Extensions to :Lib:site-python, by the way,
112 see the release notes.
113- Developers kit: all header files and some tools and sample projects
114 to get you started on writing Python extensions if you have CodeWarrior.
Jack Jansen12a37b72000-05-06 23:01:07 +0000115All these except the DevKit are installed with Easy Install.
Jack Jansen83cab721997-08-26 13:25:06 +0000116
Jack Jansencbe7b1c2001-03-06 22:42:12 +0000117After the installer finishes it automatically launches the appropriate
Jack Jansen1a29ed72001-10-31 10:13:52 +0000118ConfigurePython applet, to finish configuration of your Python. If you
119run MacOS9 or later (or 8 with CarbonLib installed) you can switch
120back and forth between the classic and Carbon versions of Python by
121running either ConfigurePythonClassic or ConfigurePythonCarbon.
Jack Jansen83cab721997-08-26 13:25:06 +0000122
Jack Jansen1a29ed72001-10-31 10:13:52 +0000123Moving your Python installation after installing is generally not a
124good idea. If you have to do this anyway you should remove your
125preference file, run ConfigurePython and remove all .pyc
126files. (there's a script zappyc.py that does the latter).
Jack Jansen2e42bdd2000-11-14 20:37:37 +0000127
Jack Jansen83cab721997-08-26 13:25:06 +0000128If you don't have enough memory: the sizes choosen are somewhat
Jack Jansen1a29ed72001-10-31 10:13:52 +0000129arbitrary, and they are as high as they are so that test.autotest runs
130with fewer problems. An average Python program can make do with much
131less memory. Try lowering the application sizes in the finder "get
132info" window, and seeing whether the resulting python is still usable.
Jack Jansen83cab721997-08-26 13:25:06 +0000133
Jack Jansen83cab721997-08-26 13:25:06 +0000134After installing
135----------------
136
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000137It is probably a good idea to run the automatic tests. Start
Jack Jansenf7e57142001-09-08 21:38:26 +0000138Python and "import test.regrtest ; test.regrtest.main()".
Jack Jansende519092000-10-12 21:21:43 +0000139
Jack Jansenb3be2162001-11-30 14:16:36 +0000140test_frozen will fail in MacPython because of different handling on
141frozen modules. This should not be a problem in normal use.
142
Jack Jansen1a29ed72001-10-31 10:13:52 +0000143test_time will fail because MacPython accepts bogus values for
144mktime(), this will be fixed later (it is not a very serious problem).
Jack Jansenf7e57142001-09-08 21:38:26 +0000145
Jack Jansenf7e57142001-09-08 21:38:26 +0000146Three tests will fail on MacOS9 with MemoryErrors:
Jack Jansen5d528b72001-10-23 22:22:09 +0000147test_longexp, test_sha and test_zlib (on MacOSX these should pass).
Jack Jansen2b73fe92001-03-27 21:38:55 +0000148
Jack Jansen1a29ed72001-10-31 10:13:52 +0000149If you increase the PythonInterpreter memory partition size they will
150pass (but for longexp you have to increase it by an incredible amount,
151400MB is rumoured). It will, however, print some messages about
152optional features not supported. You should not worry about these,
153they are modules that are supported by Python on other
154platforms. Also, if you didn't run compileall before autotesting you
155may run out of memory the first time you run the tests. test_socket
156may also fail if you have no internet connection. Please also read the
157Relnotes file for other minor problems with this distribution.
Jack Jansen83cab721997-08-26 13:25:06 +0000158
Jack Jansen1a29ed72001-10-31 10:13:52 +0000159Using Python is most easily done from the IDE, which has a builtin
160editor, debugger and other goodies. The alternative is to use
161PythonInterpreter, which is the lowlevel interpreter with a
162console-window only (similar to Unix Python).
Jack Jansen83cab721997-08-26 13:25:06 +0000163
Jack Jansen1a29ed72001-10-31 10:13:52 +0000164If your program uses Tkinter you MUST run it under PythonInterpreter,
165Tkinter and IDE are incompatible and your program will fail in strange
166ways.
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000167
Jack Jansen0b726951997-10-08 15:34:42 +0000168Uninstalling
169------------
170
Jack Jansenb9526512001-12-27 23:01:18 +0000171Up to three items are installed in the system folder: the interpreter shared
172libraries PythonCore and PythonCoreCarbon live in the Extensions
173folder and the "Python 2.2 Preferences" file in the Python subfolder
Jack Jansen1a29ed72001-10-31 10:13:52 +0000174in the Preferences folder. All the rest of Python lives in the folder
175you installed in.
Jack Jansen0b726951997-10-08 15:34:42 +0000176
Jack Jansenb9526512001-12-27 23:01:18 +0000177On OSX the libraries are installed in /Library/CFMSupport. The ConfigurePython
178applets will complain if you have no right to create the libraries there
179(you need Admin privileges). This has one consequence: you will not be able to
180run applets unless they reside in the MacPython folder (such as the IDE or
181EditPythonPrefs). If you try to run an applet stored elsewhere you will
182get a "Cannot locate PythonCore" error message.
Jack Jansenc1218bc2001-04-25 22:11:24 +0000183
Jack Jansen83cab721997-08-26 13:25:06 +0000184Things to see
185-------------
186
Jack Jansen12a37b72000-05-06 23:01:07 +0000187Start off at Mac:Demo:index.html. Read at least the first few sections.
188
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000189There are also some interesting files in the "Relnotes" folder that may
Jack Jansen83cab721997-08-26 13:25:06 +0000190contain useful information. There is also a first stab at documentation
191(plus examples) in the Mac:Demo folder. The toplevel Demo folder has
Jack Jansen12a37b72000-05-06 23:01:07 +0000192machine-independent demos.
193The Mac:Lib:test folder also has some programs that show simple
Jack Jansen83cab721997-08-26 13:25:06 +0000194capabilities of various modules.
195
Jack Jansen1a29ed72001-10-31 10:13:52 +0000196The ":Mac:scripts" folder has some sample scripts. Some are useful,
197some are just interesting to look at to see how various things
198work. The MkDistr, mkapplet and fullbuild scripts (plus the ones
199mentioned above) may help you to understand how to use AppleEvents and
200various other toolboxes from python.
Jack Jansen83cab721997-08-26 13:25:06 +0000201
Jack Jansen1a29ed72001-10-31 10:13:52 +0000202Other mac-specific goodies can be found in :Mac:Tools, of which the
203IDE sources and a CGI framework deserve special mention.
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000204
Jack Jansen83cab721997-08-26 13:25:06 +0000205The 'img' group of modules, which handles I/O of many different image
Jack Jansend0ddb661998-04-27 15:14:36 +0000206formats is included, but without documentation. You can find docs at
207ftp://ftp.cwi.nl/pub/jack/python/img (or somewhere around there).
208
209Finally there is a Mac:Contrib folder which contains some contributed
Jack Jansen12a37b72000-05-06 23:01:07 +0000210software.
Jack Jansen83cab721997-08-26 13:25:06 +0000211
212Upgrading from older Python releases
213------------------------------------
214
Jack Jansen1a29ed72001-10-31 10:13:52 +0000215Python releases are independent of each other, with separate
216Preferences files, shared library names, etc. The good news is that
217this means you can keep your older version around if you are unsure
Jack Jansen83cab721997-08-26 13:25:06 +0000218whether to upgrade. The bad news is that your old preference settings
219are lost and you have to set them again.
220
Jack Jansenb9526512001-12-27 23:01:18 +0000221After you are satisfied that 2.2 works as expected you can trash
Jack Jansen83cab721997-08-26 13:25:06 +0000222anything in the system folder that has "python" in the name and not
Jack Jansenb9526512001-12-27 23:01:18 +0000223"2.2".
Jack Jansen83cab721997-08-26 13:25:06 +0000224
Jack Jansen1a29ed72001-10-31 10:13:52 +0000225The ConfigurePython... applets will try to detect incompatible
226preferences files and offer to remove them. This means that re-running
227ConfigurePython after a second install of the same MacPython version
228(or after moving the Python folder) should fix things up correctly.
Jack Jansen2b73fe92001-03-27 21:38:55 +0000229
Jack Jansen83cab721997-08-26 13:25:06 +0000230The installer
231-------------
232
Jack Jansen12a37b72000-05-06 23:01:07 +0000233The installer for this product was created using Installer VISE
234from MindVision Software. For more information on Installer VISE,
Jack Jansen83cab721997-08-26 13:25:06 +0000235contact:
236MindVision Software
2377201 North 7th Street
238Lincoln, NE 68521-8913
239Voice: 402-477-3269
240Fax: 402-477-1395
241Internet: mindvision@mindvision.com
242http://www.mindvision.com
243
Just van Rossumd16199a2001-12-13 12:58:09 +0000244Just van Rossum <just@letterror.com> created the initial version of the
Jack Jansen12a37b72000-05-06 23:01:07 +0000245installer (with Installer Vise Lite), and Jack worked from there.
Jack Jansen83cab721997-08-26 13:25:06 +0000246
Jack Jansen01ae9eb2000-04-22 22:57:25 +0000247Thanks!
248-------
249
Jack Jansen965226b2000-09-14 20:58:24 +0000250Thanks go to the whole Python community with Guido in the lead, of
251course. Mac-specific thanks go to the pythonmac-sig, Just van Rossum,
252Corran Webster, Tony Ingraldi, Erik van Blokland, Bill Bedford, Chris
253Stern, Gordon Worley, Oliver Steele, M. Papillon, Steven Majewski, David
Jack Jansen538bd132000-10-19 21:58:27 +0000254Goodger, Chris Barker, Luc Lefebvre, Tattoo Mabonzo K., Russell Finn,
Jack Jansenf7e57142001-09-08 21:38:26 +0000255Tom Bridgman, Russel Owen, Pascal Oberndoerfer, Dean Draayer,
Jack Jansen6bc62c42001-12-20 20:41:45 +0000256Alexandre Parenteau, Donovan Preston, Daniel Brotsky, Jason Harper,
Jack Jansen402dd6e2002-01-25 16:13:38 +0000257Nitin Ganatra, Jacob Kaplan-Moss, Michael J. Barber, Tom Loredo
Jack Jansende1d4952001-08-27 15:30:48 +0000258and all the other people who provided feedback, code or both!
Jack Jansen01ae9eb2000-04-22 22:57:25 +0000259
Jack Jansen1a29ed72001-10-31 10:13:52 +0000260MacPython includes waste, a TextEdit replacement which is (c) 1998
261Marco Piovanelli.
Jack Jansende519092000-10-12 21:21:43 +0000262
Jack Jansen1a29ed72001-10-31 10:13:52 +0000263A special mention is deserved by Matthias Neeracher, who has written
264the brilliant unix-compatible GUSI I/O library, without which
265MacPython would not have sockets or select, and to Alexandre
266Parenteau, who has ported this library to Carbon.
Jack Jansen9080e9b2001-01-23 21:03:52 +0000267
Jack Jansen83cab721997-08-26 13:25:06 +0000268Feedback
269--------
270
271Send bug reports, suggestions, contributions and fanmail to
Jack Jansenecbc1cc1998-01-06 12:13:16 +0000272<jack@cwi.nl>. However, a better way to discuss MacPython is to join the
Jack Jansen83cab721997-08-26 13:25:06 +0000273<pythonmac-sig@python.org> mailing list, which is explicitly meant for
274this purpose.
275
Jack Jansenb25ec912001-03-05 15:44:55 +0000276
Jack Jansen83cab721997-08-26 13:25:06 +0000277Jack Jansen
Jack Jansenb9526512001-12-27 23:01:18 +0000278CWI
279Kruislaan 413
2801098 SJ Amsterdam
Jack Jansen83cab721997-08-26 13:25:06 +0000281the Netherlands
282
283<jack@cwi.nl>, http://www.cwi.nl/~jack