gpt4 book ai didi

python - 导入错误: No module named 'graphframes' databricks

转载 作者:行者123 更新时间:2023-12-05 05:07:13 24 4
gpt4 key购买 nike

我正在尝试将图框导入到我的 databricks 笔记本中

    from graphframes import *     

但失败并出现以下错误消息

ImportError: No module named 'graphframes'

我如何添加/导入到databricks笔记本,任何帮助表示赞赏。

最佳答案

注意:默认情况下,“graphframes”未安装在数据 block 上。

您需要显式安装该软件包。

您可以通过不同的方法安装软件包。

方法1:使用 pip cmdlet 安装外部包。

语法: %sh /databricks/python3/bin/pip install <packagename>

%sh
/databricks/python3/bin/pip install graphframes

enter image description here

方法2:使用Databricks library utilities

语法:

dbutils.library.installPyPI("pypipackage", version="version", repo="repo", extras="extras")
dbutils.library.restartPython() # Removes Python state, but some libraries might not work without calling this function

要使用 databricks 库实用程序安装 graphframes,请使用以下命令。

dbutils.library.installPyPI("graphframes") 

enter image description here

尝试了本文中提供的示例 GraphFrames Documentation .

笔记本输出:

enter image description here

希望这有帮助。

关于python - 导入错误: No module named 'graphframes' databricks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59323253/

24 4 0