首页 > 解决方案 > 如何在 Google Dataproc 集群中安装 python 包

问题描述

创建并运行集群后,是否可以在 Google Dataproc 集群中安装 python 包?

我尝试pip install xxxxxxx在主命令行中使用“”,但它似乎不起作用。

Google 的 Dataproc 文档没有提到这种情况。

标签: pythongoogle-cloud-platformgoogle-compute-enginegoogle-cloud-dataproc

解决方案


创建集群后,这通常是不可能的。我建议使用初始化操作来执行此操作。

正如您所注意到pip的,默认情况下也不可用。因此,您需要先运行easy_install pip命令pip install

最后,如果您打算在任何自动化中使用此集群,和/或您想要密封,我建议您创建一个wheel存储在 GCS 中并在 init 操作中下载的。然后你会安装你的轮子。与直接从 pip 安装许多软件包相比,Wheels 具有额外的好处。

2019 更新

请参阅本教程,了解如何在 Dataproc 上配置 Python 环境: https ://cloud.google.com/dataproc/docs/tutorials/python-configuration


推荐阅读