在 Azure Databricks 上安装 XGBoostInstall XGBoost on Azure Databricks

如果需要在 Databricks Runtime 上安装 XGBoost 或使用与预装在 Databricks Runtime ML 中的版本不同的版本,请按照以下说明操作。If you need to install XGBoost on Databricks Runtime or use a different version than the one pre-installed with Databricks Runtime ML, follow these instructions.

在 Databricks Runtime ML 中安装 XGBoostInstall XGBoost on Databricks Runtime ML

XGBoost 已包含在 Databricks Runtime ML 中。XGBoost is included in Databricks Runtime ML. 可在 Databricks Runtime ML 中使用这些库,而无需安装任何包。You can use these libraries in Databricks Runtime ML without installing any packages. 请参阅用于机器学习的 Databricks RuntimeSee Databricks Runtime for Machine Learning.

有关所使用 Databricks Runtime ML 版本中安装的 XGBoost 版本,请参阅发行说明For the version of XGBoost installed in the Databricks Runtime ML version you are using, see the release notes. 若要在 Databricks Runtime ML 中安装其他 Python 版本,请将 XGBoost 安装为 Databricks PyPI 库To install other Python versions in Databricks Runtime ML, install XGBoost as a Databricks PyPI library. 按如下所示指定版本(请将 <xgboost version> 替换为所需版本)。Specify it as the following and replace <xgboost version> with the desired version.

xgboost==<xgboost version>

在 Databricks Runtime 中安装 XGBoostInstall XGBoost on Databricks Runtime

  • Python 包:通过在笔记本单元格中执行以下命令并将 <xgboost version> 替换为所需版本来使用 Databricks 库实用工具Python package: Use Databricks Library Utilities by executing the following command in a notebook cell and replace <xgboost version> with the desired version:

    dbutils.library.installPyPI("xgboost", version="<xgboost version>" )
    
  • Scala/Java 包:使用 Spark 包名称 xgboost-linux64 安装 Databricks 库Scala/Java packages: Install as a Databricks library with the Spark Package name xgboost-linux64.