@@ -20,13 +20,6 @@ the Pythons provided by the CPython release team for download from
20
20
the `python.org website <https://www.python.org/downloads/ >`_. See
21
21
:ref: `alternative_bundles ` for some other options.
22
22
23
- .. |usemac_x_dot_y | replace :: 3.13
24
- .. |usemac_python_x_dot_y_literal | replace :: ``python3.13 ``
25
- .. |usemac_python_x_dot_y_t_literal | replace :: ``python3.13t ``
26
- .. |usemac_python_x_dot_y_t_literal_config | replace :: ``python3.13t-config ``
27
- .. |usemac_applications_folder_name | replace :: ``Python 3.13 ``
28
- .. |usemac_applications_folder_version | replace :: ``/Applications/Python 3.13/ ``
29
-
30
23
.. _getting-osx :
31
24
.. _getting-and-installing-macpython :
32
25
@@ -64,7 +57,7 @@ Clicking on the **Continue** button brings up the **Read Me** for this installer
64
57
Besides other important information, the **Read Me ** documents which Python version is
65
58
going to be installed and on what versions of macOS it is supported. You may need
66
59
to scroll through to read the whole file. By default, this **Read Me ** will also be
67
- installed in |usemac_applications_folder_version | and available to read anytime.
60
+ installed in |applications_python_version_literal | and available to read anytime.
68
61
69
62
.. image :: mac_installer_02_readme.png
70
63
@@ -97,7 +90,7 @@ When the installation is complete, the **Summary** window will appear.
97
90
.. image :: mac_installer_06_summary.png
98
91
99
92
Double-click on the :command: `Install Certificates.command `
100
- icon or file in the |usemac_applications_folder_version | window to complete the
93
+ icon or file in the |applications_python_version_literal | window to complete the
101
94
installation.
102
95
103
96
.. image :: mac_installer_07_applications.png
@@ -114,7 +107,7 @@ Close this terminal window and the installer window.
114
107
115
108
A default install will include:
116
109
117
- * A |usemac_applications_folder_name | folder in your :file: `Applications ` folder. In here
110
+ * A |python_version_literal | folder in your :file: `Applications ` folder. In here
118
111
you find :program: `IDLE `, the development environment that is a standard part of official
119
112
Python distributions; and :program: `Python Launcher `, which handles double-clicking Python
120
113
scripts from the macOS `Finder <https://support.apple.com/en-us/HT201732 >`_.
@@ -141,7 +134,7 @@ How to run a Python script
141
134
142
135
There are two ways to invoke the Python interpreter.
143
136
If you are familiar with using a Unix shell in a terminal
144
- window, you can invoke |usemac_python_x_dot_y_literal | or ``python3 `` optionally
137
+ window, you can invoke |python_x_dot_y_literal | or ``python3 `` optionally
145
138
followed by one or more command line options (described in :ref: `using-on-general `).
146
139
The Python tutorial also has a useful section on
147
140
:ref: `using Python interactively from a shell <tut-interac >`.
@@ -160,7 +153,7 @@ for more information.
160
153
To run a Python script file from the terminal window, you can
161
154
invoke the interpreter with the name of the script file:
162
155
163
- |usemac_python_x_dot_y_literal | ``myscript.py ``
156
+ |python_x_dot_y_literal | ``myscript.py ``
164
157
165
158
To run your script from the Finder, you can either:
166
159
@@ -268,7 +261,7 @@ Installing Free-threaded Binaries
268
261
269
262
The ``python.org `` :ref: `Python for macOS <getting-and-installing-macpython >`
270
263
installer package can optionally install an additional build of
271
- Python |usemac_x_dot_y | that supports :pep: `703 `, the experimental free-threading feature
264
+ Python |version | that supports :pep: `703 `, the experimental free-threading feature
272
265
(running with the :term: `global interpreter lock ` disabled).
273
266
Check the release page on ``python.org `` for possible updated information.
274
267
@@ -282,46 +275,54 @@ step of the installer as described above.
282
275
If the box next to the **Free-threaded Python ** package name is checked,
283
276
a separate :file: `PythonT.framework ` will also be installed
284
277
alongside the normal :file: `Python.framework ` in :file: `/Library/Frameworks `.
285
- This configuration allows a free-threaded Python |usemac_x_dot_y | build to co-exist
286
- on your system with a traditional (GIL only) Python |usemac_x_dot_y | build with
278
+ This configuration allows a free-threaded Python |version | build to co-exist
279
+ on your system with a traditional (GIL only) Python |version | build with
287
280
minimal risk while installing or testing. This installation layout is itself
288
281
experimental and is subject to change in future releases.
289
282
290
283
Known cautions and limitations:
291
284
292
285
- The **UNIX command-line tools ** package, which is selected by default,
293
- will install links in :file: `/usr/local/bin ` for |usemac_python_x_dot_y_t_literal |,
294
- the free-threaded interpreter, and |usemac_python_x_dot_y_t_literal_config |,
286
+ will install links in :file: `/usr/local/bin ` for |python_x_dot_y_t_literal |,
287
+ the free-threaded interpreter, and |python_x_dot_y_t_literal_config |,
295
288
a configuration utility which may be useful for package builders.
296
289
Since :file: `/usr/local/bin ` is typically included in your shell ``PATH ``,
297
290
in most cases no changes to your ``PATH `` environment variables should
298
- be needed to use |usemac_python_x_dot_y_t_literal |.
291
+ be needed to use |python_x_dot_y_t_literal |.
299
292
300
293
- For this release, the **Shell profile updater ** package and the
301
- :file: `Update Shell Profile.command ` in |usemac_applications_folder_version |
294
+ :file: `Update Shell Profile.command ` in |applications_python_version_literal |
302
295
do not support the free-threaded package.
303
296
304
297
- The free-threaded build and the traditional build have separate search
305
298
paths and separate :file: `site-packages ` directories so, by default,
306
299
if you need a package available in both builds, it may need to be installed in both.
307
300
The free-threaded package will install a separate instance of :program: `pip ` for use
308
- with |usemac_python_x_dot_y_t_literal |.
301
+ with |python_x_dot_y_t_literal |.
309
302
310
303
- To install a package using :command: `pip ` without a :command: `venv `:
311
304
312
- |usemac_python_x_dot_y_t_literal | ``-m pip install <package_name> ``
305
+ .. parsed-literal ::
306
+
307
+ python\ |version |\ t -m pip install <package_name>
313
308
314
309
- When working with multiple Python environments, it is usually safest and easiest
315
310
to :ref: `create and use virtual environments <tut-venv >`.
316
311
This can avoid possible command name conflicts and confusion about which Python is in use:
317
312
318
- |usemac_python_x_dot_y_t_literal | ``-m venv <venv_name> ``
313
+ .. parsed-literal ::
314
+
315
+ python\ |version |\ t -m venv <venv_name>
316
+
319
317
320
318
then :command: `activate `.
321
319
322
320
- To run a free-threaded version of IDLE:
323
321
324
- |usemac_python_x_dot_y_t_literal | ``-m idlelib ``
322
+ .. parsed-literal ::
323
+
324
+ python\ |version |\ t -m idlelib
325
+
325
326
326
327
- The interpreters in both builds respond to the same
327
328
:ref: `PYTHON environment variables <using-on-envvars >`
@@ -337,28 +338,28 @@ Known cautions and limitations:
337
338
thus it only needs to be run once.
338
339
339
340
- If you cannot depend on the link in ``/usr/local/bin `` pointing to the
340
- ``python.org `` free-threaded |usemac_python_x_dot_y_t_literal | (for example, if you want
341
+ ``python.org `` free-threaded |python_x_dot_y_t_literal | (for example, if you want
341
342
to install your own version there or some other distribution does),
342
343
you can explicitly set your shell ``PATH `` environment variable to
343
344
include the ``PythonT `` framework ``bin `` directory:
344
345
345
- .. code-block :: sh
346
+ .. parsed-literal ::
346
347
347
- export PATH=" /Library/Frameworks/PythonT.framework/Versions/3.13 /bin" :" $PATH "
348
+ export PATH="/Library/Frameworks/PythonT.framework/Versions/\ | version | \ /bin":"$PATH"
348
349
349
350
The traditional framework installation by default does something similar,
350
351
except for :file: `Python.framework `. Be aware that having both framework ``bin ``
351
352
directories in ``PATH `` can lead to confusion if there are duplicate names
352
- like `` python3.13 `` in both; which one is actually used depends on the order
353
+ like | python_x_dot_y_literal | in both; which one is actually used depends on the order
353
354
they appear in ``PATH ``. The ``which python3.x `` or ``which python3.xt ``
354
355
commands can show which path is being used. Using virtual environments
355
356
can help avoid such ambiguities. Another option might be to create
356
357
a shell :command: `alias ` to the desired interpreter, like:
357
358
358
- .. code-block :: sh
359
+ .. parsed-literal ::
359
360
360
- alias py3.13 =" /Library/Frameworks/Python.framework/Versions/3.13 /bin/python3.13 "
361
- alias py3.13t =" /Library/Frameworks/PythonT.framework/Versions/3.13 /bin/python3.13t "
361
+ alias py \ | version | \ ="/Library/Frameworks/Python.framework/Versions/\ | version | \ /bin/python \ | version | \ "
362
+ alias py \ | version | \ t ="/Library/Frameworks/PythonT.framework/Versions/\ | version | \ /bin/python \ | version | \ t "
362
363
363
364
Installing using the command line
364
365
---------------------------------
@@ -369,22 +370,22 @@ the macOS command line :command:`installer` utility lets you select non-default
369
370
options, too. If you are not familiar with :command: `installer `, it can be
370
371
somewhat cryptic (see :command: `man installer ` for more information).
371
372
As an example, the following shell snippet shows one way to do it,
372
- using the `` 3.13.0b2 `` release and selecting the free-threaded interpreter
373
+ using the | x_dot_y_b2_literal | release and selecting the free-threaded interpreter
373
374
option:
374
375
375
- .. code-block :: sh
376
+ .. parsed-literal ::
376
377
377
- RELEASE=" python-3.13. 0b2-macos11.pkg"
378
+ RELEASE="python-\ | version | \ 0b2-macos11.pkg"
378
379
379
380
# download installer pkg
380
- curl -O https://www.python.org/ftp/python/3.13 .0/${RELEASE}
381
+ curl -O \ h ttps://www.python.org/ftp/python/\ | version | \ .0/${RELEASE}
381
382
382
383
# create installer choicechanges to customize the install:
383
- # enable the PythonTFramework-3.13 package
384
+ # enable the PythonTFramework-\ | version | \ package
384
385
# while accepting the other defaults (install all other packages)
385
386
cat > ./choicechanges.plist <<EOF
386
387
<?xml version="1.0" encoding="UTF-8"?>
387
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
388
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "\ h ttp://www.apple.com/DTDs/PropertyList-1.0.dtd">
388
389
<plist version="1.0">
389
390
<array>
390
391
<dict>
@@ -393,7 +394,7 @@ option:
393
394
<key>choiceAttribute</key>
394
395
<string>selected</string>
395
396
<key>choiceIdentifier</key>
396
- <string>org.python.Python.PythonTFramework-3.13 </string>
397
+ <string>org.python.Python.PythonTFramework-\ | version | \ </string>
397
398
</dict>
398
399
</array>
399
400
</plist>
@@ -404,19 +405,19 @@ option:
404
405
405
406
You can then test that both installer builds are now available with something like:
406
407
407
- .. code-block:: console
408
+ .. parsed-literal ::
408
409
409
410
$ # test that the free-threaded interpreter was installed if the Unix Command Tools package was enabled
410
- $ /usr/local/bin/python3.13t -VV
411
- Python 3.13. 0b2 experimental free-threading build (v3.13 .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
411
+ $ /usr/local/bin/python \ | version | \ t -VV
412
+ Python \ | version | \ . 0b2 experimental free-threading build (v \ | version | \ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
412
413
$ # and the traditional interpreter
413
- $ /usr/local/bin/python3.13 -VV
414
- Python 3.13. 0b2 (v3.13 .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]
414
+ $ /usr/local/bin/python \ | version | \ -VV
415
+ Python \ | version | \ . 0b2 (v \ | version | \ .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]
415
416
$ # test that they are also available without the prefix if /usr/local/bin is on $PATH
416
- $ python3.13t -VV
417
- Python 3.13. 0b2 experimental free-threading build (v3.13 .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
418
- $ python3.13 -VV
419
- Python 3.13. 0b2 (v3.13 .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]
417
+ $ python \ | version | \ t -VV
418
+ Python \ | version | \ . 0b2 experimental free-threading build (v \ | version | \ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
419
+ $ python \ | version | \ -VV
420
+ Python \ | version | \ . 0b2 (v \ | version | \ .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]
420
421
421
422
.. note ::
422
423
0 commit comments