在 Windows 上安装 SQL Server 机器学习服务(Python 和 R)Install SQL Server Machine Learning Services (Python and R) on Windows

适用于:Applies to: 是SQL Server 2017 (14.x)SQL Server 2017 (14.x)yesSQL Server 2017 (14.x)SQL Server 2017 (14.x) 及更高版本适用于:Applies to: 是SQL Server 2017 (14.x)SQL Server 2017 (14.x)yesSQL Server 2017 (14.x)SQL Server 2017 (14.x) and later

了解如何在 Windows 上安装 SQL Server 机器学习服务。Learn how to install SQL Server Machine Learning Services on Windows. 可使用机器学习服务在数据库中执行 Python 和 R 脚本。You can use Machine Learning Services to execute Python and R scripts in-database.

安装前清单 Pre-install checklist

  • 需要数据库引擎实例。A database engine instance is required. 不能只安装 Python 或 R 功能,但可以将它们逐渐添加到现有实例。You can't install just Python or R features, although you can add them incrementally to an existing instance.

  • 为了实现业务连续性,机器学习服务支持 Always On 可用性组For business continuity, Always On Availability Groups are supported for Machine Learning Services. 在每个节点上安装机器学习服务并配置包。Install Machine Learning Services, and configure packages, on each node.

  • SQL Server 2017 中的 Always On 故障转移群集实例 (FCI) 不支持安装机器学习服务。Installing Machine Learning Services isn't supported on an Always On Failover Cluster Instance (FCI) in SQL Server 2017. SQL Server 2019 及更高版本支持上述服务。It's supported with SQL Server 2019 and later.

  • 不要在域控制器上安装机器学习服务。Don't install Machine Learning Services on a domain controller. 安装程序的机器学习服务部分将失败。The Machine Learning Services portion of setup will fail.

  • 不要在运行数据库实例的同一台计算机上安装“共享功能” > “Machine Learning Server(独立)” 。Don't install Shared Features > Machine Learning Server (Standalone) on the same computer running a database instance. 一个独立服务器将争夺相同的资源,从而降低这两个安装的性能。A stand-alone server will compete for the same resources, diminishes the performance of both installations.

  • 支持并行安装 Python 和 R 的其他版本,但不建议这样做。Side-by-side installation with other versions of Python and R is supported but isn't recommended. 之所以支持,是因为 SQL Server 实例使用自己的开源 R 和 Anaconda 分发副本。It's supported because the SQL Server instance uses its own copies of the open-source R and Anaconda distributions. 不建议这样做,因为在 SQL Server 外部的 SQL Server 计算机上运行使用 Python 和 R 的代码可能会导致各种问题:It isn't recommended because running code that uses Python and R on a SQL Server computer outside SQL Server can lead to various problems:

    • 使用不同的库和可执行文件将创建不一致的结果,而不是 SQL Server 中运行的结果。Using a different library and executable files will create inconsistent results, than what you are running in SQL Server.
    • SQL Server 无法管理在外部库中运行的 R 和 Python 脚本,从而导致资源争用。R and Python scripts running in external libraries can't be managed by SQL Server, leading to resource contention.

备注

默认情况下,机器学习服务安装在 SQL Server 大数据群集上。Machine Learning Services is installed by default on SQL Server Big Data Clusters. 如果使用大数据群集,则无需按照本文中的步骤进行操作。You don't need to follow the steps in this article if you use a Big Data Cluster. 有关详细信息,请参阅在大数据群集上使用机器学习服务(Python 和 R)For more information, see Use Machine Learning Services (Python and R) on Big Data Clusters.

重要

安装完成后,请务必完成本文中所述的配置后步骤。After setup is complete, be sure to complete the post-configuration steps described in this article. 这些步骤包括启用 SQL Server 以使用外部脚本,以及以你的名义添加 SQL Server 运行 R 和 Python 作业所需的帐户。These steps include enabling SQL Server to use external scripts and adding accounts required for SQL Server to run R and Python jobs on your behalf. 配置更改通常需要重启实例或重启 Launchpad 服务。Configuration changes generally require a restart of the instance or a restart of the Launchpad service.

获取安装介质Get the installation media

SQL ServerSQL Server 的下载位置由版本决定:The download location for SQL ServerSQL Server depends on the edition:

  • “SQL Server Enterprise、Standard 和 Express Edition” 已获授权,可供生产之用。SQL Server Enterprise, Standard, and Express Editions are licensed for production use. 对于企业版和标准版,请联系软件供应商获取安装媒体。For the Enterprise and Standard Editions, contact your software vendor for the installation media. 你可以在 Microsoft 采购网站上找到采购信息和 Microsoft 合作伙伴目录。You can find purchasing information and a directory of Microsoft partners on the Microsoft purchasing website.
  • 最新免费版本The latest free edition.

有关哪些 SQL Server 版本支持将 Python 和 R 与机器学习服务集成的详细信息,请参阅 SQL Server 2017 的版本和受支持的功能For more information on which SQL Server editions support Python and R integration with Machine Learning Services, see Editions and supported features of SQL Server 2017.

有关哪些 SQL Server 版本支持将 Python 和 R 与机器学习服务集成的详细信息,请参阅 SQL Server 2019 (15.x) 的版本和受支持的功能For more information on which SQL Server editions support Python and R integration with Machine Learning Services, see Editions and supported features of SQL Server 2019 (15.x).

运行安装程序Run setup

对于本地安装,必须以管理员身份运行安装程序。For local installations, you must run the setup as an administrator. 如果从远程共享安装 SQL ServerSQL Server ,则必须使用对远程共享具有读取和执行权限的域帐户。If you install SQL ServerSQL Server from a remote share, you must use a domain account that has read and execute permissions on the remote share.

  1. 启动 SQL Server 的安装向导。Start the setup wizard for SQL Server.

  2. 在“安装”选项卡上,选择“全新 SQL Server 独立安装或向现有安装添加功能” 。On the Installation tab, select New SQL Server stand-alone installation or add features to an existing installation.

    全新 SQL Server 独立安装

    全新 SQL Server 独立安装

  3. 在“功能选择” 页上,选择以下选项:On the Feature Selection page, select these options:

    • 数据库引擎服务Database Engine Services

      若要将 R 和 Python 与 SQL Server 结合使用,则必须安装数据库引擎实例。To use R and Python with SQL Server, you must install an instance of the database engine. 可使用默认实例或命名实例。You can use either a default or a named instance.

    • 机器学习服务(数据库内)Machine Learning Services (In-Database)

      此选项安装支持 R 和 Python 脚本执行的数据库服务。This option installs the database services that support R and Python script execution.

    • 数据库引擎服务Database Engine Services

      若要将 R 或 Python 与 SQL Server 结合使用,则必须安装数据库引擎实例。To use R or Python with SQL Server, you must install an instance of the database engine. 可使用默认实例或命名实例。You can use either a default or a named instance.

    • 机器学习服务(数据库内)Machine Learning Services (In-Database)

      此选项安装支持 R 和 Python 脚本执行的数据库服务。This option installs the database services that support R and Python script execution.

    • RR

      选中此选项可添加 Microsoft R 包、解释器和开源 R。Check this option to add the Microsoft R packages, interpreter, and open-source R.

    • PythonPython

      选中此选项可添加 Microsoft Python 包、Python 3.5 可执行文件以及从 Anaconda 分发中选择库。Check this option to add the Microsoft Python packages, the Python 3.5 executable, and select libraries from the Anaconda distribution.

    有关安装和使用 Java 的信息,请参阅在 Windows 上安装 SQL Server 语言扩展For information on installing and using Java, see Install SQL Server Language Extensions on Windows.

    R 和 Python 的功能选项Feature options for R and Python

    R 和 Python 的功能选项Feature options for R and Python

    备注

    不要选择 Machine Learning Server(独立)对应的选项。Don't select the option for Machine Learning Server (Standalone). 在“共享功能”下安装 Machine Learning Server 的选项适用于在单独的计算机上使用。The option to install Machine Learning Server under Shared Features is intended for use on a separate computer.

  1. 在“同意安装 Microsoft R Open”页上,选择“接受”,然后选择“下一步” 。On the Consent to Install Microsoft R Open page, select Accept and then Next.

许可协议涵盖以下内容:The license agreement covers:

  • Microsoft R OpenMicrosoft R Open
  • 开放源代码 R 基本包和工具Open-source R base packages and tools
  • Microsoft 开发团队提供的增强 R 包和连接提供程序。Enhanced R packages and connectivity providers from the Microsoft development team.
  1. 在“同意安装 Python”页上,选择“接受”,然后选择“下一步” 。On the Consent to Install Python page, select Accept and then Next. Python 开源许可协议还涵盖了 Anaconda 和相关工具,以及 Microsoft 开发团队提供的一些新 Python 库。The Python open-source licensing agreement also covers Anaconda and related tools, plus some new Python libraries from the Microsoft development team.

    备注

    如果正在使用的计算机无法访问 Internet,则可以在此时暂停安装以单独下载安装程序。If the computer you are using doesn't have internet access, you can pause setup at this point to download the installers separately. 有关详细信息,请参阅在没有 Internet 连接的情况下安装机器学习组件For more information, see Install machine learning components without internet access.

  2. 在“准备安装”页面上,验证是否已包括这些选择,然后选择“安装” 。On the Ready to Install page, verify that these selections are included, and select Install.

    • 数据库引擎服务Database Engine Services
    • 机器学习服务(数据库内)Machine Learning Services (In-Database)
    • R 和/或 PythonR or Python, or both

    请注意配置文件存储路径 ..\Setup Bootstrap\Log 下的文件夹位置。Note of the location of the folder under the path ..\Setup Bootstrap\Log where the configuration files are stored. 安装完成后,可以在“摘要”文件中查看已安装的组件。When setup is complete, you can review the installed components in the Summary file.

  3. 安装完成后,如果收到重启计算机的指示,请立即重启。After setup is complete, if you are instructed to restart the computer, do so now. 安装完成后,请务必阅读来自安装向导的消息。It's important to read the message from the Installation Wizard when you have finished with setup. 有关详细信息,请参阅 查看和读取 SQL Server 安装程序日志文件For more information, see View and Read SQL Server Setup Log Files.

  1. 在“同意安装 Microsoft R Open”页上,选择“接受”,然后选择“下一步” 。On the Consent to Install Microsoft R Open page, select Accept and then Next. 该许可协议涵盖 Microsoft R Open,其中包括分发开源 R 基础包和工具,以及 Microsoft 开发团队提供的增强型 R 包和连接提供程序。This license agreement covers Microsoft R Open, which includes a distribution of the open-source R base packages and tools, together with enhanced R packages and connectivity providers from the Microsoft development team.

  2. 在“同意安装 Python”页上,选择“接受”,然后选择“下一步” 。On the Consent to Install Python page, select Accept and then Next. Python 开源许可协议还涵盖了 Anaconda 和相关工具,以及 Microsoft 开发团队提供的一些新 Python 库。The Python open-source licensing agreement also covers Anaconda and related tools, plus some new Python libraries from the Microsoft development team.

  3. 在“准备安装”页面上,验证是否已包括这些选择,然后选择“安装” 。On the Ready to Install page, verify that these selections are included, and select Install.

    • 数据库引擎服务Database Engine Services
    • 机器学习服务(数据库内)Machine Learning Services (In-Database)
    • R 和/或 PythonR and/or Python

    请注意配置文件存储路径 ..\Setup Bootstrap\Log 下的文件夹位置。Note the location of the folder under the path ..\Setup Bootstrap\Log where the configuration files are stored. 安装完成后,可以在“摘要”文件中查看已安装的组件。When setup is complete, you can review the installed components in the Summary file.

  4. 安装完成后,如果收到重启计算机的指示,请立即重启。After setup is complete, if you're instructed to restart the computer, do so now. 安装完成后,请务必阅读来自安装向导的消息。It is important to read the message from the Installation Wizard when you've finished with setup. 有关详细信息,请参阅 查看和读取 SQL Server 安装程序日志文件For more information, see View and Read SQL Server Setup Log Files.

设置环境变量Set environment variables

(仅适用于 R 功能集成)应设置“MKL_CBWR”环境变量,以确保从 Intel 数学核心函数库 (MKL) 计算得到一致的输出结果For R feature integration only, you should set the MKL_CBWR environment variable to ensure consistent output from Intel Math Kernel Library (MKL) calculations.

  1. 在“控制面板”中,单击“系统和安全” > “系统” > “高级系统设置” > “环境变量” 。In Control Panel, click System and Security > System > Advanced System Settings > Environment Variables.

  2. 创建新的用户或系统变量。Create a new User or System variable.

    • 将变量名称设置为 MKL_CBWRSet variable name to MKL_CBWR
    • 将变量值设置为 AUTOSet the variable value to AUTO

此步骤需要重启服务器。This step requires a server restart. 如果要启用脚本执行,则可以在完成所有配置工作之前暂停重启。If you are about to enable script execution, you can hold off on the restart until all of the configuration work is done.

启用脚本执行Enable script execution

  1. 打开 SQL Server Management StudioSQL Server Management StudioOpen SQL Server Management StudioSQL Server Management Studio.

    提示

    可以从此页下载并安装相应的版本:下载 SQL Server Management Studio (SSMS)You can download and install the appropriate version from this page: Download SQL Server Management Studio (SSMS).

    还可以使用 Azure Data Studio,它支持管理任务和针对 SQL Server 的查询。You can also use Azure Data Studio, which supports administrative tasks and queries against SQL Server.

  2. 连接到安装了机器学习服务的实例,单击“新建查询”打开查询窗口,然后运行以下命令:Connect to the instance where you installed Machine Learning Services, click New Query to open a query window, and run the following command:

    sp_configure
    

    属性 external scripts enabled 的值目前应为 0The value for the property, external scripts enabled, should be 0 at this point. 默认情况下,此功能处于关闭状态。The feature is turned off by default. 必须先由管理员显式启用此功能,然后才能运行 R 或 Python 脚本。The feature must be explicitly enabled by an administrator before you can run R or Python scripts.

  3. 若要启用外部脚本编写功能,请运行以下语句:To enable the external scripting feature, run the following statement:

    EXEC sp_configure  'external scripts enabled', 1
    RECONFIGURE WITH OVERRIDE
    

    如果已为 R 语言启用此功能,请不要对 Python 再次运行 reconfigure 命令。If you have already enabled the feature for the R language, don't run reconfigure a second time for Python. 基础扩展性平台支持这两种语言。The underlying extensibility platform supports both languages.

重新启动服务。Restart the service

安装完成后,重启数据库引擎。When the installation is complete, restart the database engine.

重启服务也会自动重启相关的 SQL Server LaunchpadSQL Server Launchpad 服务。Restarting the service also automatically restarts the related SQL Server LaunchpadSQL Server Launchpad service.

可以使用右键单击 SSMS 中实例的“重启”命令、使用“控制面板”中的“服务”面板,或者使用 SQL Server 配置管理器来重启服务 。You can restart the service using the right-click Restart command for the instance in SSMS, or by using the Services panel in Control Panel, or by using SQL Server Configuration Manager.

验证安装Verify installation

使用以下步骤验证用于启动外部脚本的所有组件是否都在运行。Use the following steps to verify that all components used to launch external script are running.

  1. 在 SQL Server Management 中打开新的“查询”窗口,然后运行以下命令:In SQL Server Management Studio, open a new query window, and run the following command:

    EXECUTE sp_configure  'external scripts enabled'
    

    run_value 设置为 1。The run_value is set to 1.

  2. 打开“服务”面板或 SQL Server 配置管理器,并验证“SQL Server Launchpad”是否正在运行 。Open the Services panel or SQL Server Configuration Manager, and verify SQL Server Launchpad service is running. 应该为每个安装了 R 或 Python 的数据库引擎实例提供一项服务。You should have one service for every database engine instance that has R or Python installed. 有关该服务的详细信息,请参阅扩展性框架For more information about the service, see Extensibility framework.

  3. 如果 Launchpad 正在运行,则可以运行简单的 Python 和 R 脚本,以验证外部脚本运行时是否可以与 SQL Server 通信。If Launchpad is running, you can run simple Python and R scripts to verify that external scripting runtimes can communicate with SQL Server.

    SQL Server Management StudioSQL Server Management Studio 中打开新的“查询”窗口,然后运行如下脚本:Open a new Query window in SQL Server Management StudioSQL Server Management Studio, and then run a script such as:

    • 对于 RFor R

      EXEC sp_execute_external_script  @language =N'R',
      @script=N'
      OutputDataSet <- InputDataSet;
      ',
      @input_data_1 =N'SELECT 1 AS hello'
      WITH RESULT SETS (([hello] int not null));
      GO
      
    • 对于 PythonFor Python

      EXEC sp_execute_external_script  @language =N'Python',
      @script=N'
      OutputDataSet = InputDataSet;
      ',
      @input_data_1 =N'SELECT 1 AS hello'
      WITH RESULT SETS (([hello] int not null));
      GO
      

    结果Results

    如果是首次加载外部脚本运行时,则该脚本可能需要一些时间才能运行。The script can take a little while to run, the first time the external script runtime is loaded. 结果应如下所示:The results should be something like this:

    Hellohello
    11

备注

不会自动返回 Python 脚本中使用的列或标题。Columns or headings used in the Python script aren't returned automatically. 若要在输出结果中添加列名称,则必须为返回数据集指定架构。To add column names for your output, you must specify the schema for the return data set. 为此,请使用存储过程的 WITH RESULTS 参数,命名列并指定 SQL 数据类型。Do this by using the WITH RESULTS parameter of the stored procedure, naming the columns, and specifying the SQL data type.

例如,可以添加以下行来生成任意列名:WITH RESULT SETS ((Col1 AS int))For example, you can add the following line to generate an arbitrary column name: WITH RESULT SETS ((Col1 AS int))

应用更新Apply updates

现有安装Existing installation

如果已将机器学习服务添加到现有 SQL Server 实例,并且之前应用了累积更新 (CU),则数据库引擎版本和机器学习服务功能可能会有所不同。If you have added Machine Learning Services to an existing SQL Server instance and have previously applied a Cumulative Update (CU), the versions of your database engine and the Machine Learning Services feature might be different. 这可能会导致意外行为或错误。This may result in unexpected behavior or errors.

执行以下步骤,将机器学习服务引入与数据库引擎相同的版本。Follow these steps to bring the Machine Learning Services to the same version as your database engine.

  1. 确定用于数据库引擎的累积更新 (CU)。Determine the Cumulative Update (CU) you have for the database engine. 运行此 T-SQL 语句:Run this T-SQL statement:

    SELECT @@VERSION
    

    下面是 SQL Server 2019 累积更新 (CU) 8 的输出示例:Here is an example output from SQL Server 2019 Cumulative Update (CU) 8:

    Microsoft SQL Server 2019 (RTM-CU8-GDR) (KB4583459) - 15.0.4083.2 (X64) 2020 年 11 月 2 日 18:35:09 版权所有 (C) 2019 Microsoft Corporation Windows 10 Enterprise 10.0 开发人员版(64 位)(内部版本 19042:)(虚拟机监控程序)Microsoft SQL Server 2019 (RTM-CU8-GDR) (KB4583459) - 15.0.4083.2 (X64) Nov 2 2020 18:35:09 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Enterprise 10.0 (Build 19042: ) (Hypervisor)

    有关详细信息,请参阅确定 SQL Server 及其组件的版本、版本类别和更新级别For more information, see Determine the version, edition, and update level of SQL Server and its components.

  2. 下载已为数据库引擎安装的累积更新 (CU)Download the Cumulative Update (CU) that you have installed for the database engine.

  3. 运行以安装累积更新 (CU),并按照说明安装机器学习服务的 CU。Run the installation of the Cumulative Update (CU) and follow the instructions to install the CU for Machine Learning Services.

新安装New installation

如果在 SQL Server 数据库引擎的新安装中安装机器学习服务,建议将最新累积更新应用于数据库引擎和机器学习组件。If you install Machine Learning Services with a new installation of SQL Server database engine, we recommend that you apply the latest cumulative update to both the database engine and machine learning components.

在连接 Internet 的设备上,累积更新通常通过 Windows 更新进行应用,但也可以使用以下步骤进行可控更新。On internet-connected devices, cumulative updates are typically applied through Windows Update, but you can also use the steps below for controlled updates. 为数据库引擎应用更新时,安装程序将为你在同一实例上安装的任何 Python 或 R 功能拉取累积更新。When you apply the update for the database engine, setup pulls cumulative updates for any Python or R features you installed on the same instance.

断开连接的服务器需要执行额外的步骤。Disconnected servers require extra steps. 有关详细信息,请参阅 在没有 Internet 连接的计算机上安装 > 应用累积更新For more information, see Install on computers with no internet access > Apply cumulative updates.

  1. 开始使用已安装的基线实例:SQL Server 初始版本。Start with a baseline instance already installed: SQL Server initial release.

  2. 请转到累积更新列表:Microsoft SQL Server 的最新更新Go to the cumulative update list: Latest updates for Microsoft SQL Server.

  3. 选择最新的累积更新。Select the latest cumulative update. 自动下载并提取可执行文件。An executable is downloaded and extracted automatically.

  4. 运行安装程序。Run Setup. 接受许可条款,然后在“功能选择”页上,查看应用了累积更新的功能。Accept the licensing terms, and on the Feature selection page, review the features for which cumulative updates are applied. 应看到为当前实例安装的每个功能,包括机器学习功能。You should see every feature installed for the current instance, including machine learning features. 安装程序会下载更新所有功能所需的 CAB 文件。Setup downloads the CAB files necessary to update all features.

    已安装功能的摘要

  5. 继续执行向导,接受 R 和 Python 分发的许可条款。Continue through the wizard, accepting the licensing terms for R and Python distributions.

其他配置Additional configuration

如果外部脚本验证步骤成功,则可以从 SQL Server Management Studio、Visual Studio Code 或者能够向服务器发送 T-SQL 语句的其他任何客户端运行 R 或 Python 命令。If the external script verification step was successful, you can run R or Python commands from SQL Server Management Studio, Visual Studio Code, or any other client that can send T-SQL statements to the server.

如果在运行命令时遇到错误,请查看本部分中的其他配置步骤。If you got an error when running the command, review the additional configuration steps in this section. 服务或数据库可能需要进行其他适当的配置。You might need to make additional appropriate configurations to the service or database.

在实例级别,其他配置可能包括:At the instance level, additional configuration might include:

在 Windows 上的 SQL Server 2019 中,隔离机制已发生更改。In SQL Server 2019 on Windows, the isolation mechanism has changed. 此机制会影响 SQLRUserGroup、防火墙规则、文件权限和默示身份验证。This mechanism affects SQLRUserGroup, firewall rules, file permission, and implied authentication. 有关详细信息,请参阅 机器学习服务的隔离更改For more information, see Isolation changes for Machine Learning Services.

数据库上可能需要以下配置更新:On the database, you might need the following configuration updates:

备注

是否需要其他配置取决于安全架构、SQL Server 的安装位置,以及期望用户以何方式连接到数据库和运行外部脚本。Whether the additional configuration is required depends on your security schema, where you installed SQL Server, and how you expect users to connect to the database and run external scripts.

建议的优化Suggested optimizations

现在所有工作已顺利进行,可能还需要优化服务器以支持机器学习,或安装预先训练的机器学习模型。Now that you have everything working, you might also want to optimize the server to support machine learning or install a pre-trained machine learning model.

添加更多辅助角色帐户Add more worker accounts

如果预期会有很多用户同时运行脚本,则可以增加分配给 Launchpad 服务的辅助角色帐户数目。If you expect many users to be running scripts concurrently, you can increase the number of worker accounts that are assigned to the Launchpad service. 有关详细信息,请参阅在 SQL Server 机器学习服务中扩展外部脚本的并发执行For more information, see Scale concurrent execution of external scripts in SQL Server Machine Learning Services.

优化服务器执行脚本Optimize the server for script execution

SQL ServerSQL Server 安装程序的默认设置旨在为数据库引擎支持的各种服务(可能包括提取、转换和加载 (ETL) 进程、报告、审核和使用 SQL ServerSQL Server 数据的应用程序)优化服务器平衡。The default settings for SQL ServerSQL Server setup are intended to optimize the balance of the server for a variety of services that are supported by the database engine, which might include extract, transform, and load (ETL) processes, reporting, auditing, and applications that use SQL ServerSQL Server data. 在默认设置下,机器学习(尤其是占用大量内存的操作)的资源有时会被限制或被阻止。Under the default settings, resources for machine learning are sometimes restricted or throttled, particularly in memory-intensive operations.

若要确保机器学习作业的优先级并为其分配适当资源,建议使用 SQL Server Resource Governor 配置外部资源池。To ensure that machine learning jobs are prioritized and resourced appropriately, we recommend that you use SQL Server Resource Governor to configure an external resource pool. 可能还要更改分配到 SQL ServerSQL Server 数据库引擎的内存量,或增加 SQL Server LaunchpadSQL Server Launchpad 服务下运行的帐户数。You might also want to change the amount of memory that's allocated to the SQL ServerSQL Server database engine, or increase the number of accounts that run under the SQL Server LaunchpadSQL Server Launchpad service.

如果使用的是 Standard Edition 且没有 Resource Governor,则可以使用动态管理视图 (DMV) 和扩展事件以及 Windows 事件监视来帮助管理服务器资源。If you are using Standard Edition and don't have Resource Governor, you can use Dynamic Management Views (DMVs) and Extended Events, as well as Windows event monitoring, to help manage the server resources.

安装其他 Python 和 R 包Install additional Python and R packages

为 SQL Server 创建的 Python 和 R 解决方案可以调用基本功能、随 SQL Server 一起安装的专有包中的功能以及与 SQL Server 安装的开源 Python 和 R 版本兼容的第三方包。The Python and R solutions you create for SQL Server can call basic functions, functions from the proprietary packages installed with SQL Server, and third-party packages compatible with the version of open-source Python and R installed by SQL Server.

要通过 SQL Server 使用的包必须安装在实例使用的默认库中。Packages that you want to use from SQL Server must be installed in the default library used by the instance. 如果在计算机上单独安装了 Python 或 R,或者将包安装到了用户库,则无法从 T-SQL 使用这些包。If you have a separate installation of Python or R on the computer, or if you installed packages to user libraries, you can't use those packages from T-SQL.

若要安装和管理其他包,可以将用户组设置为共享每个数据库级别的包,或者通过配置数据库角色使用户能够安装自己的包。To install and manage additional packages, you can set up user groups to share packages on a per-database level, or configure database roles to enable users to install their own packages. 有关详细信息,请参阅安装 Python 包安装新的 R 包For more information, see Install Python packages and Install new R packages.

后续步骤Next steps

Python 开发人员可以通过以下教程了解如何将 Python 与 SQL Server 一起使用:Python developers can learn how to use Python with SQL Server by following these tutorials:

R 开发人员可以开始使用一些简单的示例,并了解 R 如何与 SQL Server 协同工作的基础知识。R developers can get started with some simple examples, and learn the basics of how R works with SQL Server. 有关下一步,请参阅以下链接:For your next step, see the following links: