Lines Matching +full:build +full:- +full:with +full:- +full:python
2 Python on macOS README
6 Jack Jansen (2004-07),
7 Ronald Oussoren (2010-04),
8 Ned Deily (2012-06)
11 the Python distribution.
16 The core developers primarily test builds on macOS with Apple's compiler tools,
17 either Xcode or the Command Line Tools. For these we only support building with
18 a compiler that includes an SDK that targets the OS on the build machine, that is
19 the version of Xcode that shipped with the OS version or one newer.
24 Building with other compilers, such as GCC, likely works, but is not actively supported.
29 * ``--enable-framework[=DIR]``
31 If this argument is specified the build will create a Python.framework rather
33 _`Building and using a framework-based Python on macOS` for more
37 into that directory. This can be used to install a python framework into
40 $ ./configure --enable-framework=/Users/ronald/Library/Frameworks
45 command-line tools in ``/Users/ronald/bin``.
47 * ``--with-framework-name=NAME``
49 Specify the name for the python framework, defaults to ``Python``. This option
50 is only valid when ``--enable-framework`` is specified.
52 * ``--enable-universalsdk[=PATH]``
54 Create a universal binary build of Python. This can be used with both
58 build. In most cases on current systems, you do not need to specify PATH or
64 The Apple-supplied build tools handle this transparently and current
65 versions of Python now handle this as well. So it is no longer necessary,
67 headers with ``xcode-select``.
69 * ``--with-universal-archs=VALUE``
72 only valid when ``--enable-universalsdk`` is specified. The default is
73 ``32-bit`` if building with a SDK that supports PPC, otherwise defaults
74 to ``intel``. Note that ``intel`` means a universal build of both 32-bit
75 and 64-bit binaries and that may not be what you want; for example,
76 as of macOS 10.15 Catalina, 32-bit execution is no longer supported by
78 values for ``--with-universal-archs``:
80 ``--enable-universalsdk --with-universal-archs=intel-64``
85 Building and using a universal binary of Python on macOS
89 -----------------------------
91 A universal binary build of Python contains object code for more than one
93 architecture-specific code into one file and can therefore run at native
95 macOS 10.4 to add support for Intel-based Macs to the existing PowerPC (PPC)
96 machines. In macOS 10.5 support was extended to 64-bit Intel and 64-bit PPC
97 architectures. It is possible to build Python with various combinations
98 of architectures depending on the build tools and macOS version in use.
99 Note that PPC support was removed in macOS 10.7 and 32-bit Intel support
101 supports one execution architecture, 64-bit Intel (``x86_64``).
103 2. How do I build a universal binary
104 ------------------------------------
106 You can enable universal binaries by specifying the "--enable-universalsdk"
109 $ ./configure --enable-universalsdk
113 This flag can be used with a framework build of python, but also with a classic
114 unix build. Universal builds were first supported with macOS 10.4 with Xcode 2.1
115 and the 10.4u SDK. Starting with Xcode 3 and macOS 10.5, more configurations are
119 Apple-supplied compilers and other build tools included in Apple's Xcode
122 Python Developer's Guide (https://devguide.python.org/setup/)
128 It is possible to build a number of flavors of the universal binary build,
129 the default is a 32-bit only binary (i386 and ppc) in build environments that
130 support ppc (10.4 with Xcode 2, 10.5 and 10.6 with Xcode 3) or an
131 Intel-32/-64-bit binary (i386 and X86_64) in build environments that do not
133 using the configure option ``--with-universal-archs=VALUE``. The following
140 * ``intel-32``: ``i386``
142 * ``intel-64``: ``x86_64``
144 * ``32-bit``: ``ppc``, ``i386``
146 * ``3-way``: ``i386``, ``x86_64``, ``ppc``
148 * ``64-bit``: ``ppc64``, ``x86_64``
152 To build a universal binary that includes a 64-bit architecture, you must build
153 on a system running macOS 10.5 or later. The ``all`` and ``64-bit`` flavors can
154 only be built with a 10.5 SDK because ``ppc64`` support was only included with
155 macOS 10.5. Although legacy ``ppc`` support was included with Xcode 3 on macOS
158 following combinations of SDKs and universal-archs flavors are available:
160 * 10.4u SDK with Xcode 2 supports ``32-bit`` only
162 * 10.5 SDK with Xcode 3.1.x supports all flavors
164 * 10.6 SDK with Xcode 3.2.x supports ``intel``, ``intel-32``,
165 ``intel-64``, ``3-way``, and ``32-bit``
167 * 10.6 SDK with Xcode 4 supports ``intel``, ``intel-32``, and ``intel-64``
169 * 10.7 through 10.14 SDKs support ``intel``, ``intel-32``, and ``intel-64``
171 * 10.15 and later SDKs support ``intel-64`` only
175 The makefile for a framework build will also install ``python3.x-32``
176 binaries when the universal architecture includes at least one 32-bit
177 architecture (that is, for all flavors but ``64-bit`` and ``intel-64``).
178 It will also install ``python3.x-intel64`` binaries in the ``universal2``
179 case to allow easy execution with the Rosetta 2 Intel emulator on Apple
187 $ arch -i386 python
189 Or to explicitly run in 32-bit mode, regardless of the machine hardware::
191 $ arch -i386 -ppc python
195 under that Python. If you want to ensure that Python interpreters launched in
196 subprocesses also run in 32-bit-mode if the main interpreter does, use
197 a ``python3.x-32`` binary and use the value of ``sys.executable`` as the
200 Likewise, use ``python3.x-intel64`` to force execution in ``x86_64`` mode
201 with ``universal2`` binaries.
203 Building and using a framework-based Python on macOS
207 1. Why would I want a framework Python instead of a normal static Python?
208 -------------------------------------------------------------------------
210 The main reason is because you want to create GUI programs in Python. With the
211 exception of X11/XDarwin-based GUI toolkits all GUI programs need to be run
217 A second reason for using frameworks is that they put Python-related items in
218 only two places: "/Library/Framework/Python.framework" and
219 "/Applications/Python <VERSION>" where ``<VERSION>`` can be e.g. "3.8",
221 Python from a binary distribution if they want to get rid of it again. Moreover,
225 2. How does a framework Python differ from a normal static Python?
226 ------------------------------------------------------------------
229 a different place. If you look in /Library/Frameworks/Python.framework
231 details. If you are used to a normal unix Python file layout go down to
235 ----------------------------
239 aware, though, that the Cocoa-based AquaTk's supplied starting with macOS
242 the ActiveTcl 8.6. See https://www.python.org/download/mac/tcltk/. If you
243 are building with an SDK, ensure that the newer Tcl and Tk frameworks are
249 4. How do I build a framework Python?
250 -------------------------------------
252 This directory contains a Makefile that will create a couple of python-related
253 applications (full-blown macOS .app applications, that is) in
254 "/Applications/Python <VERSION>", and a hidden helper application Python.app
255 inside the Python.framework, and unix tools including "python" into
257 the relevant portions of the Mac subtree into the Python.framework.
262 1. ./configure --enable-framework
268 This sequence will put the framework in ``/Library/Framework/Python.framework``,
269 the applications in ``/Applications/Python <VERSION>`` and the unix tools in
274 by configuring with ``--enable-framework=$HOME/Library/Frameworks``.
276 at ``$HOME/Applications/Python-<VERSION>`` and ``$HOME/bin``.
279 frameworkinstall is composed of a couple of sub-targets that install the
284 "/Applications/Python <VERSION>", this is useful for binary
290 "IDLE.app" is an integrated development environment for Python: editor,
293 "Python Launcher.app" is a helper application that will handle things when you
294 double-click a .py, .pyc or .pyw file. For the first two it creates a Terminal
295 window and runs the scripts with the normal command-line Python. For the
296 latter it runs the script in the Python.app interpreter so the script can do
297 GUI-things. Keep the ``Option`` key depressed while dragging or double-clicking
299 through Python Launcher's preferences dialog.
301 The program ``pythonx.x`` runs python scripts from the command line.
303 ``pythonwx.x`` which in early releases of Python on macOS was required to run
309 Download and unpack the source release from https://www.python.org/download/.
311 ``build-installer.py`` that does all the work. This will download and build
312 a number of 3rd-party libraries, configures and builds a framework Python,
314 DMG image. The script also builds an HTML copy of the current Python
319 The script will build a universal binary so you'll therefore have to run this
320 script on macOS 10.4 or later and with Xcode 2.1 or later installed.
321 However, the Python build process itself has several build dependencies not
322 available out of the box with macOS 10.4 so you may have to install
323 additional software beyond what is provided with Xcode 2.
325 versions of Xcode to build installers that are compatible with older systems
329 dependencies. It is safest to build the distribution on a system running the
333 use your normal build directory nor does it install into /.
337 command-line arguments, run it with --help for more information.
348 configure: WARNING: libintl.h: proceeding with the preprocessor's result
350 configure: WARNING: ## -------------------------------------------------------- ##
351 configure: WARNING: ## Report this to https://github.com/python/cpython/issues/ ##
352 configure: WARNING: ## -------------------------------------------------------- ##
354 This almost always means you are trying to build a universal binary for
355 Python and have libraries in ``/usr/local`` that don't contain the required
356 architectures. Temporarily move ``/usr/local`` aside to finish the build.
367 ``/Library/Frameworks/Python.framework``. This can contain multiple versions
368 of Python, if you want to remove just one version you have to remove the
369 version-specific subdirectory: ``/Library/Frameworks/Python.framework/Versions/X.Y``.
370 If you do that, ensure that ``/Library/Frameworks/Python.framework/Versions/Current``
371 is a symlink that points to an installed version of Python.
373 A framework install also installs some applications in ``/Applications/Python X.Y``,
376 them symbolic links to files in ``/Library/Frameworks/Python.framework/Versions/X.Y/bin``.
381 The CPython sources support building with the latest SDK while targeting deployment
415 * https://www.python.org/downloads/macos/
417 * https://www.python.org/community/sigs/current/pythonmac-sig/
419 * https://devguide.python.org/