# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # python-doc bot, 2025 # 99 , 2026 # Freesand Leo , 2026 # zhoubo, 2026 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.15\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-11-05 20:53+0000\n" "PO-Revision-Date: 2025-09-16 00:02+0000\n" "Last-Translator: zhoubo, 2026\n" "Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: zh_CN\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../using/mac.rst:7 msgid "Using Python on macOS" msgstr "在 macOS 上使用 Python" #: ../../using/mac.rst:9 msgid "" "This document aims to give an overview of macOS-specific behavior you should" " know about to get started with Python on Mac computers. Python on a Mac " "running macOS is very similar to Python on other Unix-derived platforms, but" " there are some differences in installation and some features." msgstr "" "本文档旨在为您于 Mac 电脑上开始使用 Python 前提供您必须了解的 macOS 平台之特有行为。在运行了 macOS 的 Mac 电脑上使用 " "Python 与在其他 Unix 家族平台电脑上面使用 Python 的体验非常相近,但在 Python 安装及部分特性上仍存有些许差异。" #: ../../using/mac.rst:14 msgid "" "There are various ways to obtain and install Python for macOS. Pre-built " "versions of the most recent versions of Python are available from a number " "of distributors. Much of this document describes use of the Pythons provided" " by the CPython release team for download from the `python.org website " "`_. See :ref:`alternative_bundles` for " "some other options." msgstr "" "有多种途径可为 macOS 获取 Python 。多家软件分发源均提供最新版 Python 的预编译版本。本文档的多数内容描述的是由 CPython " "发布团队于 `python.org 网站 `_ 中提供下载的 Python " "版本。参见 :ref:`alternative_bundles` 获取其他选择。" #: ../../using/mac.rst:25 msgid "Using Python for macOS from ``python.org``" msgstr "使用来自 ``python.org`` 的 macOS 版 Python" #: ../../using/mac.rst:28 msgid "Installation steps" msgstr "安装步骤" #: ../../using/mac.rst:30 msgid "" "For `current Python versions `_ (other " "than those in ``security`` status), the release team produces a **Python for" " macOS** installer package for each new release. A list of available " "installers is provided on the `macOS downloads page " "`__. We recommend using the most " "recent supported Python version where possible. Current installers provide a" " `universal2 binary `_ build" " of Python which runs natively on all Macs (Apple Silicon and Intel) that " "are supported by a wide range of macOS versions, currently typically from at" " least **macOS 10.15 Catalina** on." msgstr "" "对于 `当前 Python 版本 `_ (处于 ``security`` " "状态的除外),发布团队为每个新发布版制作了 **Python for macOS** 安装程序包。 可用安装程序的列表在 `macOS " "downloads page `__ 上提供。 " "我们推荐尽可能使用最新的受支持 Python 版本。 当前安装程序提供了可原生运行于所有 Mac (Apple Silicon 和 Intel) " "并受到主要 macOS 版本支持的 `universal2 binary " "`_ Python 构建版,目前通常至少支持 " "**macOS 10.15 Catalina** 以上版本。" #: ../../using/mac.rst:42 msgid "" "The downloaded file is a standard macOS installer package file (``.pkg``). " "File integrity information (such as checksum, size, and Sigstore signature) " "for each file is included on the release download page. Installer packages " "and their contents are signed and notarized with ``Python Software " "Foundation`` Apple Developer ID certificates to meet `macOS Gatekeeper " "requirements `_." msgstr "" #: ../../using/mac.rst:48 msgid "" "For a default installation, double-click on the downloaded installer package" " file. This should launch the standard macOS Installer app and display the " "first of several installer steps." msgstr "" #: ../../using/mac.rst:54 msgid "" "Clicking on the **Continue** button brings up the **Read Me** for this " "installer. Besides other important information, the **Read Me** documents " "which Python version is going to be installed and on what versions of macOS " "it is supported. You may need to scroll through to read the whole file. By " "default, this **Read Me** will also be installed in " "|applications_python_version_literal| and available to read anytime." msgstr "" "点击 **Continue** 按钮将显示安装程序的 **Read Me**。 在其他重要信息之外,**Read Me** 文档会写明将要安装的 " "Python 版本以及它所支持的 macOS 版本。 你可能需要滚动窗口来阅读整个文件。 在默认情况下,该 **Read Me** 也会被安装在 " "|applications_python_version_literal| 中并可供随时阅读。" #: ../../using/mac.rst:62 msgid "" "Clicking on **Continue** proceeds to display the license for Python and for " "other included software. You will then need to **Agree** to the license " "terms before proceeding to the next step. This license file will also be " "installed and available to be read later." msgstr "" "点击 **继续** 按钮将会显示 Python 软件及其他随附软件的授权许可。你需要选择 **同意** " "该许可证才能继续下一步安装。同样,许可证日后也会安装在磁盘中以供随时阅读。" #: ../../using/mac.rst:69 msgid "" "After the license terms are accepted, the next step is the **Installation " "Type** display. For most uses, the standard set of installation operations " "is appropriate." msgstr "接受许可证条款后,下一步是选择您的安装类型。在大多数情况下,默认的标准安装操作就是最适合您的安装类型。" #: ../../using/mac.rst:74 msgid "" "By pressing the **Customize** button, you can choose to omit or select " "certain package components of the installer. Click on each package name to " "see a description of what it installs. For details of the optional free-" "threaded feature, which is installed by default, see :ref:`install-" "freethreaded-macos`." msgstr "" #: ../../using/mac.rst:82 msgid "" "In either case, clicking **Install** will begin the install process by " "asking permission to install new software. A macOS user name with " "``Administrator`` privilege is needed as the installed Python will be " "available to all users of the Mac." msgstr "" "不论您选择接受默认安装配置还是自定义安装配置,点击 **安装** 按钮即可开始安装过程。您可能会被要求提供安装软件所需的必要权限。您需要提供拥有 " "``Administrator`` (管理员)权限的 macOS 用户名和密码,因为 Python 会面向电脑中的所有用户安装。" #: ../../using/mac.rst:86 msgid "When the installation is complete, the **Summary** window will appear." msgstr "安装完成后会显示 **概览** 窗口。" #: ../../using/mac.rst:90 msgid "" "Double-click on the :command:`Install Certificates.command` icon or file in " "the |applications_python_version_literal| window to complete the " "installation." msgstr "" "双击 :command:`Install Certificates.command` 图标或 " "|applications_python_version_literal| 窗口中的文件来完成安装。" #: ../../using/mac.rst:96 msgid "" "This will open a temporary :program:`Terminal` shell window that will use " "the new Python to download and install SSL root certificates for its use." msgstr "这会开启一个临时的 :program:`Terminal` 命令行窗口,使用新安装的 Python 下载并安装SSL根证书供其使用。" #: ../../using/mac.rst:102 msgid "" "If ``Successfully installed certifi`` and ``update complete`` appear in the " "terminal window, the installation is complete. Close this terminal window " "and the installer window." msgstr "" "如果终端窗口中显示 ``Successfully installed certifi`` 和 ``update complete``,则安装完成。 " "请关闭该终端窗口和安装程序窗口。" #: ../../using/mac.rst:106 msgid "A default install will include:" msgstr "使用默认安装配置会安装下列内容:" #: ../../using/mac.rst:108 msgid "" "A |python_version_literal| folder in your :file:`Applications` folder. In " "here you find :program:`IDLE`, the development environment that is a " "standard part of official Python distributions; and :program:`Python " "Launcher`, which handles double-clicking Python scripts from the macOS " "`Finder `_." msgstr "" "你的 :file:`Applications` 文件夹中的 |python_version_literal| 子文件夹。 你将在这里找到 " ":program:`IDLE`,这是作为官方 Python 发行版标准组件的开发环境;以及 :program:`Python " "Launcher`,它负责处理在 macOS `Finder `_ " "中双击 Python 脚本的操作。" #: ../../using/mac.rst:113 msgid "" "A framework :file:`/Library/Frameworks/Python.framework`, which includes the" " Python executable and libraries. The installer adds this location to your " "shell path. To uninstall Python, you can remove these three things. Symlinks" " to the Python executable are placed in :file:`/usr/local/bin/`." msgstr "" "一个框架 :file:`/Library/Frameworks/Python.framework`,它包括 Python 可执行文件和库。 " "安装程序会将此位置添加到你的 shell 路径。 要卸载 Python,你可以移除这三样东西。 指向 Python 可执行文件的符号链接将位于 " ":file:`/usr/local/bin/`。" #: ../../using/mac.rst:120 msgid "" "Recent versions of macOS include a :command:`python3` command in " ":file:`/usr/bin/python3` that links to a usually older and incomplete " "version of Python provided by and for use by the Apple development tools, " ":program:`Xcode` or the :program:`Command Line Tools for Xcode`. You should " "never modify or attempt to delete this installation, as it is Apple-" "controlled and is used by Apple-provided or third-party software. If you " "choose to install a newer Python version from ``python.org``, you will have " "two different but functional Python installations on your computer that can " "co-exist. The default installer options should ensure that its " ":command:`python3` will be used instead of the system :command:`python3`." msgstr "" "最近几个版本的 macOS 都包括一个 :command:`python3` 命令 :file:`/usr/bin/python3`,它链接到一个供 " "Apple 开发工具 :program:`Xcode` 或 :program:`Command Line Tools for Xcode` " "使用的通常较老旧且不完整的 Python 版本。 你绝不应该修改或试图删除此安装版,因为它是由 Apple 控制且由 Apple " "提供的或第三方的软件所使用。 如果你选择安装一个来自 ``python.org`` 的更新的 Python " "版本,在你的计算机上将有两个不相同但均能正常运行的 Python 安装版共存。 默认安装程序选项应当会确保使用它的 :command:`python3`" " 而不是系统的 :command:`python3`。" #: ../../using/mac.rst:131 msgid "How to run a Python script" msgstr "如何运行 Python 脚本" #: ../../using/mac.rst:133 msgid "" "There are two ways to invoke the Python interpreter. If you are familiar " "with using a Unix shell in a terminal window, you can invoke " "|python_x_dot_y_literal| or ``python3`` optionally followed by one or more " "command line options (described in :ref:`using-on-general`). The Python " "tutorial also has a useful section on :ref:`using Python interactively from " "a shell `." msgstr "" "有两种方式可以唤起 Python 解释器。 如果你熟悉如何在终端窗口中使用 Unix shell,你可以唤起 " "|python_x_dot_y_literal| 或 ``python3`` 并可选择带一个或多个命令行选项(见 :ref:`using-on-" "general` 中的说明)。 Python 教程也包含了一个有关 :ref:`通过 shell 交互式地使用 Python ` 的实用章节。" #: ../../using/mac.rst:140 msgid "" "You can also invoke the interpreter through an integrated development " "environment. :ref:`idle` is a basic editor and interpreter environment which" " is included with the standard distribution of Python. :program:`IDLE` " "includes a Help menu that allows you to access Python documentation. If you " "are completely new to Python, you can read the tutorial introduction in that" " document." msgstr "" "你也可以通过集成开发环境即 IDE 来唤起解释器。 :ref:`idle` 是一个包括在标准 Python 发行版中的具有基础功能的编辑器和解释器环境。" " :program:`IDLE` 还包括一个 Help 菜单允许你访问 Python 文档。 如果你是完全的 Python " "新手,你可以阅读此文档中的入门教程。" #: ../../using/mac.rst:148 msgid "" "There are many other editors and IDEs available, see :ref:`editors` for more" " information." msgstr "还有许多其他可用的编辑器和 IDE,请参阅 :ref:`editors` 了解详情。" #: ../../using/mac.rst:151 msgid "" "To run a Python script file from the terminal window, you can invoke the " "interpreter with the name of the script file:" msgstr "要在终端窗口运行一个 Python 脚本,你可以在唤起解释器时附带脚本文件名:" #: ../../using/mac.rst:154 msgid "|python_x_dot_y_literal| ``myscript.py``" msgstr "|python_x_dot_y_literal| ``myscript.py``" #: ../../using/mac.rst:156 msgid "To run your script from the Finder, you can either:" msgstr "要从 Finder (访达)运行你的脚本,你有两种选择:" #: ../../using/mac.rst:158 msgid "Drag it to :program:`Python Launcher`." msgstr "将其拖拽到 :program:`Python Launcher`。" #: ../../using/mac.rst:160 msgid "" "Select :program:`Python Launcher` as the default application to open your " "script (or any ``.py`` script) through the Finder Info window and double-" "click it. :program:`Python Launcher` has various preferences to control how " "your script is launched. Option-dragging allows you to change these for one " "invocation, or use its ``Preferences`` menu to change things globally." msgstr "" "选择 :program:`Python Launcher` 作为通过 Finder Info 窗口打开你的脚本(或任何 ``.py`` " "脚本)和双击它时的默认应用程序。 :program:`Python Launcher` 具有多个首选项来控制脚本的启动方式。 " "选项拖拽允许你为单次唤起更改这些首选项,或使用其 ``Preferences`` 菜单进行全局性的更改。" #: ../../using/mac.rst:166 msgid "" "Be aware that running the script directly from the macOS Finder might " "produce different results than when running from a terminal window as the " "script will not be run in the usual shell environment including any setting " "of environment variables in shell profiles. And, as with any other script or" " program, be certain of what you are about to run." msgstr "" "请注意从 macOS Finder 直接运行脚本可能产生与从终端窗口运行时不同的结果,因为脚本将不是在通常的包括了 shell 配置文件中所有环境变量的" " shell 环境中运行。 因此,就如使用任何其他脚本或程序一样,请注意确认你想要运行的到底是什么。" #: ../../using/mac.rst:176 msgid "Alternative distributions" msgstr "其他发行版" #: ../../using/mac.rst:178 msgid "" "Besides the standard ``python.org`` for macOS installer, there are third-" "party distributions for macOS that may include additional functionality. " "Some popular distributions and their key features:" msgstr "" "除了标准 ``python.org`` macOS 安装程序,还有一些针对 macOS 的包括附加功能的第三方发行版。 " "以下是一些受欢迎的发行版及其关键特性:" #: ../../using/mac.rst:182 msgid "`ActivePython `_" msgstr "`ActivePython `_" #: ../../using/mac.rst:183 msgid "Installer with multi-platform compatibility, documentation" msgstr "具有多平台兼容性的安装器,文档" #: ../../using/mac.rst:185 msgid "`Anaconda `_" msgstr "`Anaconda `_" #: ../../using/mac.rst:186 msgid "" "Popular scientific modules (such as numpy, scipy, and pandas) and the " "``conda`` package manager." msgstr "流行的科学模块(如 numpy, scipy 和 pandas)以及 ``conda`` 包管理器。" #: ../../using/mac.rst:189 msgid "`Homebrew `_" msgstr "`Homebrew `_" #: ../../using/mac.rst:190 msgid "" "Package manager for macOS including multiple versions of Python and many " "third-party Python-based packages (including numpy, scipy, and pandas)." msgstr "" "针对 macOS 的包管理器包括多个 Python 版本和许多基于 Python 的第三方包(包括 numpy, scipy 和 pandas)。" #: ../../using/mac.rst:193 msgid "`MacPorts `_" msgstr "`MacPorts `_" #: ../../using/mac.rst:194 msgid "" "Another package manager for macOS including multiple versions of Python and " "many third-party Python-based packages. May include pre-built versions of " "Python and many packages for older versions of macOS." msgstr "" "另一个针对 macOS 的包括多个 Python 版本和许多基于 Python 的第三方软件包的包管理器。 可能包括 Python " "的预构建版和许多用于较旧版本 macOS 的软件包。" #: ../../using/mac.rst:198 msgid "" "Note that distributions might not include the latest versions of Python or " "other libraries, and are not maintained or supported by the core Python " "team." msgstr "请注意这些发行版可能不包括 Python 或其他库的最新版本,并且不被核心 Python 团队所维护或支持。" #: ../../using/mac.rst:204 msgid "Installing additional Python packages" msgstr "安装额外的 Python 包" #: ../../using/mac.rst:206 msgid "Refer to the `Python Packaging User Guide`_ for more information." msgstr "请参阅 `Python Packaging User Guide`_ 了解详情。" #: ../../using/mac.rst:216 msgid "GUI programming" msgstr "GUI 编程" #: ../../using/mac.rst:218 msgid "" "There are several options for building GUI applications on the Mac with " "Python." msgstr "使用 Python 在 Mac 上构建 GUI 应用程序有多种选择。" #: ../../using/mac.rst:220 msgid "" "The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" "platform Tk toolkit (https://www.tcl.tk). A macOS-native version of Tk is " "included with the installer." msgstr "" "标准的 Python GUI 工具包是 :mod:`tkinter`,基于跨平台的 Tk 工具包 (https://www.tcl.tk)。 " "安装器包括了一个 macOS 原生版本的 Tk。" #: ../../using/mac.rst:224 msgid "" "*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework. " "Information on PyObjC is available from :pypi:`pyobjc`." msgstr "" "*PyObjC* 是一个针对 Apple 的 Objective-C/Cocoa 框架的 Python 绑定。 有关 PyObjC 的信息可从 " ":pypi:`pyobjc` 获取。" #: ../../using/mac.rst:227 msgid "A number of alternative macOS GUI toolkits are available including:" msgstr "有多个替代性的 macOS GUI 工具包可供使用,包括:" #: ../../using/mac.rst:229 msgid "" "`PySide `_: Official Python bindings to the" " `Qt GUI toolkit `_." msgstr "" "`PySide `_: `Qt GUI 工具包 " "`_ 的官方 Python 绑定。" #: ../../using/mac.rst:232 msgid "" "`PyQt `_: Alternative Python " "bindings to Qt." msgstr "" "`PyQt `_: Qt 的另一款 Python 绑定。" #: ../../using/mac.rst:235 msgid "" "`Kivy `_: A cross-platform GUI toolkit that supports " "desktop and mobile platforms." msgstr "`Kivy `_: 一款支持桌面和移动平台的跨平台 GUI 工具包。" #: ../../using/mac.rst:238 msgid "" "`Toga `_: Part of the `BeeWare Project " "`_; supports desktop, mobile, web and console apps." msgstr "" "`Toga `_: `BeeWare 项目 `_ " "的一部分;支持桌面、移动设备、Web 和控制台应用。" #: ../../using/mac.rst:241 msgid "" "`wxPython `_: A cross-platform toolkit that supports " "desktop operating systems." msgstr "`wxPython `_: 一款支持桌面操作系统的跨平台工具包。" #: ../../using/mac.rst:244 msgid "" "`Flet `_: A framework for building cross-platform " "desktop, mobile, and web applications in Python." msgstr "" #: ../../using/mac.rst:249 msgid "Advanced topics" msgstr "进阶主题" #: ../../using/mac.rst:254 msgid "Installing free-threaded binaries" msgstr "安装自由线程二进制文件" #: ../../using/mac.rst:258 msgid "Free-threading support is now installed by default." msgstr "自由线程支持现在将默认被安装。" #: ../../using/mac.rst:261 msgid "" "The ``python.org`` :ref:`Python for macOS ` installer package installs, by default, an additional build of " "Python |version| that supports :term:`free threading` (running with the " ":term:`global interpreter lock` disabled). Check the release page on " "``python.org`` for possible updated information." msgstr "" #: ../../using/mac.rst:267 msgid "" "The free-threaded mode is working and continues to be improved, but there is" " some additional overhead in single-threaded workloads compared to the " "regular build. Additionally, third-party packages, in particular ones with " "an :term:`extension module`, may not be ready for use in a free-threaded " "build, and will re-enable the :term:`GIL`. As of Python 3.15, free-threading" " support is installed by default. It is packaged as a separate install " "option, which can be deselected by clicking the **Customize** button on the " "**Installation Type** step of the installer as described above." msgstr "" #: ../../using/mac.rst:279 msgid "" "If the box next to the **Free-threaded Python** package name is checked (as " "it is by default), a separate :file:`PythonT.framework` will also be " "installed alongside the normal :file:`Python.framework` in " ":file:`/Library/Frameworks`. This configuration allows a free-threaded " "Python |version| build to co-exist on your system with a traditional (GIL " "only) Python |version| build with minimal risk while installing or testing. " "This installation layout may change in future releases." msgstr "" #: ../../using/mac.rst:288 msgid "Known cautions and limitations:" msgstr "已知的注意事项和限制:" #: ../../using/mac.rst:290 msgid "" "The **UNIX command-line tools** package, which is selected by default, will " "install links in :file:`/usr/local/bin` for |python_x_dot_y_t_literal|, the " "free-threaded interpreter, and |python_x_dot_y_t_literal_config|, a " "configuration utility which may be useful for package builders. Since " ":file:`/usr/local/bin` is typically included in your shell ``PATH``, in most" " cases no changes to your ``PATH`` environment variable should be needed to " "use |python_x_dot_y_t_literal|." msgstr "" #: ../../using/mac.rst:298 msgid "" "For this release, the **Shell profile updater** package and the " ":file:`Update Shell Profile.command` in " "|applications_python_version_literal| do not support the free-threaded " "package." msgstr "" "对于本发布版,**Shell profile updater** 软件包和 |applications_python_version_literal| " "中的 :file:`Update Shell Profile.command` 均不支持自由线程的软件包。" #: ../../using/mac.rst:302 msgid "" "The free-threaded build and the traditional build have separate search paths" " and separate :file:`site-packages` directories so, by default, if you need " "a package available in both builds, it may need to be installed in both. The" " free-threaded package will install a separate instance of :program:`pip` " "for use with |python_x_dot_y_t_literal|." msgstr "" "自由线程构建版和传统构建版具有不同的搜索路径和不同的 :file:`site-packages` " "目录,因此在默认情况下,如果你需要让某个包在两个构建版中均可用,可能需要在两版中都安装。 自由线程的软件包将安装单独的 :program:`pip` " "来配合 |python_x_dot_y_t_literal| 使用。" #: ../../using/mac.rst:308 msgid "To install a package using :command:`pip` without a :command:`venv`:" msgstr "不带 :command:`venv` 地使用 :command:`pip` 来安装软件包:" #: ../../using/mac.rst:312 msgid "python\\ |version|\\ t -m pip install " msgstr "python\\ |version|\\ t -m pip install " #: ../../using/mac.rst:314 msgid "" "When working with multiple Python environments, it is usually safest and " "easiest to :ref:`create and use virtual environments `. This can " "avoid possible command name conflicts and confusion about which Python is in" " use:" msgstr "" "在操作多个 Python 环境时,:ref:`创建和使用虚拟环境 ` 通常是最安全和便捷的方式。 " "这可以避免可能的命令名称冲突和究竟是哪个 Python 正在被使用的困惑:" #: ../../using/mac.rst:320 msgid "python\\ |version|\\ t -m venv " msgstr "python\\ |version|\\ t -m venv " #: ../../using/mac.rst:323 msgid "then :command:`activate`." msgstr "然后执行 :command:`activate`。" #: ../../using/mac.rst:325 msgid "To run a free-threaded version of IDLE:" msgstr "要运行 IDLE 的自由线程版本:" #: ../../using/mac.rst:329 msgid "python\\ |version|\\ t -m idlelib" msgstr "python\\ |version|\\ t -m idlelib" #: ../../using/mac.rst:332 msgid "" "The interpreters in both builds respond to the same :ref:`PYTHON environment" " variables ` which may have unexpected results, for " "example, if you have ``PYTHONPATH`` set in a shell profile. If necessary, " "there are :ref:`command line options ` like " "``-E`` to ignore these environment variables." msgstr "" "两个构建版中的解释器响应相同的 :ref:`PYTHON 环境变量 ` 可能导致预料之外的结果,举例来说,如果你在 " "shell 配置文件中设置了 ``PYTHONPATH`` 的话。 如有必要,可以使用像 ``-E`` 这样的 :ref:`命令行选项 ` 来忽略这些环境变量。" #: ../../using/mac.rst:339 msgid "" "The free-threaded build links to the third-party shared libraries, such as " "``OpenSSL`` and ``Tk``, installed in the traditional framework. This means " "that both builds also share one set of trust certificates as installed by " "the :command:`Install Certificates.command` script, thus it only needs to be" " run once." msgstr "" "自由线程构建版会链接安装在传统框架中的第三方共享库,如 ``OpenSSL`` 和 ``Tk``。 这意味着两个构建版还会共享同一个由 " ":command:`Install Certificates.command` 脚本所安装的信任证书,因此它只须运行一次。" #: ../../using/mac.rst:345 msgid "" "If you cannot depend on the link in ``/usr/local/bin`` pointing to the " "``python.org`` free-threaded |python_x_dot_y_t_literal| (for example, if you" " want to install your own version there or some other distribution does), " "you can explicitly set your shell ``PATH`` environment variable to include " "the ``PythonT`` framework ``bin`` directory:" msgstr "" "如果你不能依赖 ``/usr/local/bin`` 中指向 ``python.org`` 自由线程 " "|python_x_dot_y_t_literal| 的链接(举例来说,如果你想在其中安装你自己的版本或者其他发行版要这样做),你可以显式设置你的 " "``PATH`` 环境变量以包括 ``PythonT`` 框架的 ``bin`` 目录:" #: ../../using/mac.rst:353 msgid "" "export PATH=\"/Library/Frameworks/PythonT.framework/Versions/\\ |version|\\ " "/bin\":\"$PATH\"" msgstr "" "export PATH=\"/Library/Frameworks/PythonT.framework/Versions/\\ |version|\\ " "/bin\":\"$PATH\"" #: ../../using/mac.rst:355 msgid "" "The traditional framework installation by default does something similar, " "except for :file:`Python.framework`. Be aware that having both framework " "``bin`` directories in ``PATH`` can lead to confusion if there are duplicate" " names like |python_x_dot_y_literal| in both; which one is actually used " "depends on the order they appear in ``PATH``. The ``which python3.x`` or " "``which python3.xt`` commands can show which path is being used. Using " "virtual environments can help avoid such ambiguities. Another option might " "be to create a shell :command:`alias` to the desired interpreter, like:" msgstr "" "传统框架安装版默认会做类似的事情,但 :file:`Python.framework` 除外。 请注意将两个框架的 ``bin`` 目录都放入 " "``PATH`` 在存在重名如 |python_x_dot_y_literal| 时可能会导致混淆;实际是使用哪一个取决于它们在 ``PATH`` " "中的出现顺序。 ``which python3.x`` 或 ``which python3.xt`` 命令可以显示正在使用哪个路径。 " "使用虚拟环境有助于避免这样的歧义。 另一种选项是创建一个 shell :command:`alias` 指向特定解释器,例如:" #: ../../using/mac.rst:366 msgid "" "alias py\\ |version|\\ =\"/Library/Frameworks/Python.framework/Versions/\\ |version|\\ /bin/python\\ |version|\\ \"\n" "alias py\\ |version|\\ t=\"/Library/Frameworks/PythonT.framework/Versions/\\ |version|\\ /bin/python\\ |version|\\ t\"" msgstr "" "alias py\\ |version|\\ =\"/Library/Frameworks/Python.framework/Versions/\\ |version|\\ /bin/python\\ |version|\\ \"\n" "alias py\\ |version|\\ t=\"/Library/Frameworks/PythonT.framework/Versions/\\ |version|\\ /bin/python\\ |version|\\ t\"" #: ../../using/mac.rst:370 msgid "Installing using the command line" msgstr "使用命令行安装" #: ../../using/mac.rst:372 msgid "" "If you want to use automation to install the ``python.org`` installer " "package (rather than by using the familiar macOS :program:`Installer` GUI " "app), the macOS command line :command:`installer` utility lets you select " "non-default options, too. If you are not familiar with :command:`installer`," " it can be somewhat cryptic (see :command:`man installer` for more " "information). As an example, the following shell snippet shows one way to do" " it, using the |x_dot_y_b2_literal| release and deselecting the free-" "threaded interpreter option:" msgstr "" #: ../../using/mac.rst:383 msgid "" "RELEASE=\"python-\\ |version|\\ .0b2-macos11.pkg\"\n" "\n" "# download installer pkg\n" "curl -O \\https://www.python.org/ftp/python/\\ |version|\\ .0/${RELEASE}\n" "\n" "# create installer choicechanges to customize the install:\n" "# disable the PythonTFramework-\\ |version|\\ package\n" "# while accepting the other defaults (install all other packages)\n" "cat > ./choicechanges.plist <\n" "\n" "\n" "\n" " \n" " attributeSetting\n" " 0\n" " choiceAttribute\n" " selected\n" " choiceIdentifier\n" " org.python.Python.PythonTFramework-\\ |version|\\ \n" " \n" "\n" "\n" "EOF\n" "\n" "sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./choicechanges.plist -target /" msgstr "" "RELEASE=\"python-\\ |version|\\ .0b2-macos11.pkg\"\n" "\n" "# download installer pkg\n" "curl -O \\https://www.python.org/ftp/python/\\ |version|\\ .0/${RELEASE}\n" "\n" "# create installer choicechanges to customize the install:\n" "# disable the PythonTFramework-\\ |version|\\ package\n" "# while accepting the other defaults (install all other packages)\n" "cat > ./choicechanges.plist <\n" "\n" "\n" "\n" " \n" " attributeSetting\n" " 0\n" " choiceAttribute\n" " selected\n" " choiceIdentifier\n" " org.python.Python.PythonTFramework-\\ |version|\\ \n" " \n" "\n" "\n" "EOF\n" "\n" "sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./choicechanges.plist -target /" #: ../../using/mac.rst:411 msgid "" "After a default install, you can test that both builds are available with " "something like:" msgstr "在默认安装之后,你可以这样测试两个构建版是否都可用:" #: ../../using/mac.rst:415 msgid "" "$ # test that the free-threaded interpreter was installed if the Unix Command Tools package was enabled\n" "$ /usr/local/bin/python\\ |version|\\ t -VV\n" "Python \\ |version|\\ .0b2 free-threading build (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" "$ # and the traditional interpreter\n" "$ /usr/local/bin/python\\ |version|\\ -VV\n" "Python \\ |version|\\ .0b2 (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]\n" "$ # test that they are also available without the prefix if /usr/local/bin is on $PATH\n" "$ python\\ |version|\\ t -VV\n" "Python \\ |version|\\ .0b2 free-threading build (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" "$ python\\ |version|\\ -VV\n" "Python \\ |version|\\ .0b2 (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]" msgstr "" "$ # test that the free-threaded interpreter was installed if the Unix Command Tools package was enabled\n" "$ /usr/local/bin/python\\ |version|\\ t -VV\n" "Python \\ |version|\\ .0b2 free-threading build (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" "$ # and the traditional interpreter\n" "$ /usr/local/bin/python\\ |version|\\ -VV\n" "Python \\ |version|\\ .0b2 (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]\n" "$ # test that they are also available without the prefix if /usr/local/bin is on $PATH\n" "$ python\\ |version|\\ t -VV\n" "Python \\ |version|\\ .0b2 free-threading build (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" "$ python\\ |version|\\ -VV\n" "Python \\ |version|\\ .0b2 (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]" #: ../../using/mac.rst:429 msgid "" "Current ``python.org`` installers only install to fixed locations like " ":file:`/Library/Frameworks/`, :file:`/Applications`, and " ":file:`/usr/local/bin`. You cannot use the :command:`installer` ``-domain`` " "option to install to other locations." msgstr "" "当前的 ``python.org`` 安装器只会安装到固定位置如 :file:`/Library/Frameworks/`, " ":file:`/Applications` 和 :file:`/usr/local/bin`。 你不能使用 :command:`installer` " "``-domain`` 选项来安装到其他位置。" #: ../../using/mac.rst:437 msgid "Distributing Python applications" msgstr "分发 Python 应用程序" #: ../../using/mac.rst:439 msgid "" "A range of tools exist for converting your Python code into a standalone " "distributable application:" msgstr "有一系列工具可将你的 Python 代码转换为独立发布的应用程序:" #: ../../using/mac.rst:442 msgid "" ":pypi:`py2app`: Supports creating macOS ``.app`` bundles from a Python " "project." msgstr ":pypi:`py2app`: 支持基于 Python 项目创建 macOS ``.app`` 软件包。" #: ../../using/mac.rst:445 msgid "" "`Briefcase `_: Part of the `BeeWare " "Project `_; a cross-platform packaging tool that " "supports creation of ``.app`` bundles on macOS, as well as managing signing " "and notarization." msgstr "" "`Briefcase `_: `BeeWare 项目 " "`_ 的一部分;一款支持在 macOS 上创建 ``.app`` 捆绑包,并能管理签名和公证的跨平台打包工具。" #: ../../using/mac.rst:450 msgid "" "`PyInstaller `_: A cross-platform packaging tool " "that creates a single file or folder as a distributable artifact." msgstr "" "`PyInstaller `_: 一款可创建单独文件或文件夹作为可分发包的跨平台打包工具。" #: ../../using/mac.rst:454 msgid "App Store compliance" msgstr "App Store 合规性" #: ../../using/mac.rst:456 msgid "" "Apps submitted for distribution through the macOS App Store must pass " "Apple's app review process. This process includes a set of automated " "validation rules that inspect the submitted application bundle for " "problematic code." msgstr "" "在 macOS App Store 中提交发布的 app 必须通过 Apple 的 app 审核进程。 " "此进程包括一组在所提交的应用程序包中自动检查有问题代码的验证规则。" #: ../../using/mac.rst:460 msgid "" "The Python standard library contains some code that is known to violate " "these automated rules. While these violations appear to be false positives, " "Apple's review rules cannot be challenged. Therefore, it is necessary to " "modify the Python standard library for an app to pass App Store review." msgstr "" "Python 标准库包含了一些已知会违反这些自动规则的代码。 虽然这些违规情况看来是属于误报,但 Apple 的审核规则是不可挑战的。 因此,有必要修改" " Python 标准库以便 app 能够通过 App Store 的审核。" #: ../../using/mac.rst:465 msgid "" "The Python source tree contains :source:`a patch file ` that will remove all code that is known to cause " "issues with the App Store review process. This patch is applied " "automatically when CPython is configured with the :option:`--with-app-store-" "compliance` option." msgstr "" "Python 源代码树包含 :source:`一个补丁文件 ` " "可移除所有已知的会导致 App Store 审核过程出现问题的代码。 这个补丁会在 CPython 配置了 :option:`--with-app-" "store-compliance` 选项时自动应用。" #: ../../using/mac.rst:471 msgid "" "This patch is not normally required to use CPython on a Mac; nor is it " "required if you are distributing an app *outside* the macOS App Store. It is" " *only* required if you are using the macOS App Store as a distribution " "channel." msgstr "" "这个补丁对于在 Mac 上使用 CPython 并不是必需的;如果你是在 macOS App Store *以外* 的地方发布 app 它也不是必需的。" " 它 *只有* 在你使用 macOS App Store 作为发布渠道时才是必需的。" #: ../../using/mac.rst:476 msgid "Other resources" msgstr "其他资源" #: ../../using/mac.rst:478 msgid "" "The `python.org Help page `_ has links " "to many useful resources. The `Pythonmac-SIG mailing list " "`_ is another " "support resource specifically for Python users and developers on the Mac." msgstr "" "`python.org Help 页面 `_ 包含许多有用资源的链接。 " "`Pythonmac-SIG 邮件列表 " "`_ 是另一个专门针对 " "Mac 上的 Python 用户和开发者的支持资源。"