blob: 8e8d47766d6bb4dd90cb67139611ee9fafbd5861 [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 Jansenf7e57142001-09-08 21:38:26 +0000143Three tests will fail on MacOS9 with MemoryErrors:
Jack Jansen5d528b72001-10-23 22:22:09 +0000144test_longexp, test_sha and test_zlib (on MacOSX these should pass).
Jack Jansen2b73fe92001-03-27 21:38:55 +0000145
Jack Jansen1a29ed72001-10-31 10:13:52 +0000146If you increase the PythonInterpreter memory partition size they will
147pass (but for longexp you have to increase it by an incredible amount,
148400MB is rumoured). It will, however, print some messages about
149optional features not supported. You should not worry about these,
150they are modules that are supported by Python on other
151platforms. Also, if you didn't run compileall before autotesting you
152may run out of memory the first time you run the tests. test_socket
153may also fail if you have no internet connection. Please also read the
154Relnotes file for other minor problems with this distribution.
Jack Jansen83cab721997-08-26 13:25:06 +0000155
Jack Jansen1a29ed72001-10-31 10:13:52 +0000156Using Python is most easily done from the IDE, which has a builtin
157editor, debugger and other goodies. The alternative is to use
158PythonInterpreter, which is the lowlevel interpreter with a
159console-window only (similar to Unix Python).
Jack Jansen83cab721997-08-26 13:25:06 +0000160
Jack Jansen1a29ed72001-10-31 10:13:52 +0000161If your program uses Tkinter you MUST run it under PythonInterpreter,
162Tkinter and IDE are incompatible and your program will fail in strange
163ways.
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000164
Jack Jansen0b726951997-10-08 15:34:42 +0000165Uninstalling
166------------
167
Jack Jansenb9526512001-12-27 23:01:18 +0000168Up to three items are installed in the system folder: the interpreter shared
169libraries PythonCore and PythonCoreCarbon live in the Extensions
170folder and the "Python 2.2 Preferences" file in the Python subfolder
Jack Jansen1a29ed72001-10-31 10:13:52 +0000171in the Preferences folder. All the rest of Python lives in the folder
172you installed in.
Jack Jansen0b726951997-10-08 15:34:42 +0000173
Jack Jansenb9526512001-12-27 23:01:18 +0000174On OSX the libraries are installed in /Library/CFMSupport. The ConfigurePython
175applets will complain if you have no right to create the libraries there
176(you need Admin privileges). This has one consequence: you will not be able to
177run applets unless they reside in the MacPython folder (such as the IDE or
178EditPythonPrefs). If you try to run an applet stored elsewhere you will
179get a "Cannot locate PythonCore" error message.
Jack Jansenc1218bc2001-04-25 22:11:24 +0000180
Jack Jansen83cab721997-08-26 13:25:06 +0000181Things to see
182-------------
183
Jack Jansen12a37b72000-05-06 23:01:07 +0000184Start off at Mac:Demo:index.html. Read at least the first few sections.
185
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000186There are also some interesting files in the "Relnotes" folder that may
Jack Jansen83cab721997-08-26 13:25:06 +0000187contain useful information. There is also a first stab at documentation
188(plus examples) in the Mac:Demo folder. The toplevel Demo folder has
Jack Jansen12a37b72000-05-06 23:01:07 +0000189machine-independent demos.
190The Mac:Lib:test folder also has some programs that show simple
Jack Jansen83cab721997-08-26 13:25:06 +0000191capabilities of various modules.
192
Jack Jansen1a29ed72001-10-31 10:13:52 +0000193The ":Mac:scripts" folder has some sample scripts. Some are useful,
194some are just interesting to look at to see how various things
195work. The MkDistr, mkapplet and fullbuild scripts (plus the ones
196mentioned above) may help you to understand how to use AppleEvents and
197various other toolboxes from python.
Jack Jansen83cab721997-08-26 13:25:06 +0000198
Jack Jansen1a29ed72001-10-31 10:13:52 +0000199Other mac-specific goodies can be found in :Mac:Tools, of which the
200IDE sources and a CGI framework deserve special mention.
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000201
Jack Jansen83cab721997-08-26 13:25:06 +0000202The 'img' group of modules, which handles I/O of many different image
Jack Jansend0ddb661998-04-27 15:14:36 +0000203formats is included, but without documentation. You can find docs at
204ftp://ftp.cwi.nl/pub/jack/python/img (or somewhere around there).
205
206Finally there is a Mac:Contrib folder which contains some contributed
Jack Jansen12a37b72000-05-06 23:01:07 +0000207software.
Jack Jansen83cab721997-08-26 13:25:06 +0000208
209Upgrading from older Python releases
210------------------------------------
211
Jack Jansen1a29ed72001-10-31 10:13:52 +0000212Python releases are independent of each other, with separate
213Preferences files, shared library names, etc. The good news is that
214this means you can keep your older version around if you are unsure
Jack Jansen83cab721997-08-26 13:25:06 +0000215whether to upgrade. The bad news is that your old preference settings
216are lost and you have to set them again.
217
Jack Jansenb9526512001-12-27 23:01:18 +0000218After you are satisfied that 2.2 works as expected you can trash
Jack Jansen83cab721997-08-26 13:25:06 +0000219anything in the system folder that has "python" in the name and not
Jack Jansenb9526512001-12-27 23:01:18 +0000220"2.2".
Jack Jansen83cab721997-08-26 13:25:06 +0000221
Jack Jansen1a29ed72001-10-31 10:13:52 +0000222The ConfigurePython... applets will try to detect incompatible
223preferences files and offer to remove them. This means that re-running
224ConfigurePython after a second install of the same MacPython version
225(or after moving the Python folder) should fix things up correctly.
Jack Jansen2b73fe92001-03-27 21:38:55 +0000226
Jack Jansen83cab721997-08-26 13:25:06 +0000227The installer
228-------------
229
Jack Jansen12a37b72000-05-06 23:01:07 +0000230The installer for this product was created using Installer VISE
231from MindVision Software. For more information on Installer VISE,
Jack Jansen83cab721997-08-26 13:25:06 +0000232contact:
233MindVision Software
2347201 North 7th Street
235Lincoln, NE 68521-8913
236Voice: 402-477-3269
237Fax: 402-477-1395
238Internet: mindvision@mindvision.com
239http://www.mindvision.com
240
Just van Rossumd16199a2001-12-13 12:58:09 +0000241Just van Rossum <just@letterror.com> created the initial version of the
Jack Jansen12a37b72000-05-06 23:01:07 +0000242installer (with Installer Vise Lite), and Jack worked from there.
Jack Jansen83cab721997-08-26 13:25:06 +0000243
Jack Jansen01ae9eb2000-04-22 22:57:25 +0000244Thanks!
245-------
246
Jack Jansen965226b2000-09-14 20:58:24 +0000247Thanks go to the whole Python community with Guido in the lead, of
248course. Mac-specific thanks go to the pythonmac-sig, Just van Rossum,
249Corran Webster, Tony Ingraldi, Erik van Blokland, Bill Bedford, Chris
250Stern, Gordon Worley, Oliver Steele, M. Papillon, Steven Majewski, David
Jack Jansen538bd132000-10-19 21:58:27 +0000251Goodger, Chris Barker, Luc Lefebvre, Tattoo Mabonzo K., Russell Finn,
Jack Jansenf7e57142001-09-08 21:38:26 +0000252Tom Bridgman, Russel Owen, Pascal Oberndoerfer, Dean Draayer,
Jack Jansen6bc62c42001-12-20 20:41:45 +0000253Alexandre Parenteau, Donovan Preston, Daniel Brotsky, Jason Harper,
Jack Jansenca800022002-04-22 13:56:25 +0000254Nitin Ganatra, Jacob Kaplan-Moss, Michael J. Barber, Tom Loredo,
255Christopher Smith,
Jack Jansende1d4952001-08-27 15:30:48 +0000256and all the other people who provided feedback, code or both!
Jack Jansen01ae9eb2000-04-22 22:57:25 +0000257
Jack Jansen1a29ed72001-10-31 10:13:52 +0000258MacPython includes waste, a TextEdit replacement which is (c) 1998
259Marco Piovanelli.
Jack Jansende519092000-10-12 21:21:43 +0000260
Jack Jansen1a29ed72001-10-31 10:13:52 +0000261A special mention is deserved by Matthias Neeracher, who has written
262the brilliant unix-compatible GUSI I/O library, without which
263MacPython would not have sockets or select, and to Alexandre
264Parenteau, who has ported this library to Carbon.
Jack Jansen9080e9b2001-01-23 21:03:52 +0000265
Jack Jansen83cab721997-08-26 13:25:06 +0000266Feedback
267--------
268
269Send bug reports, suggestions, contributions and fanmail to
Jack Jansenecbc1cc1998-01-06 12:13:16 +0000270<jack@cwi.nl>. However, a better way to discuss MacPython is to join the
Jack Jansen83cab721997-08-26 13:25:06 +0000271<pythonmac-sig@python.org> mailing list, which is explicitly meant for
272this purpose.
273
Jack Jansenb25ec912001-03-05 15:44:55 +0000274
Jack Jansen83cab721997-08-26 13:25:06 +0000275Jack Jansen
Jack Jansenb9526512001-12-27 23:01:18 +0000276CWI
277Kruislaan 413
2781098 SJ Amsterdam
Jack Jansen83cab721997-08-26 13:25:06 +0000279the Netherlands
280
281<jack@cwi.nl>, http://www.cwi.nl/~jack