ImportError: 找不到名为 'graphframes' 的模块 databricks

3
我正在尝试将GraphFrame导入我的Databricks笔记本中。
    from graphframes import *     

但是出现了以下错误信息:

导入错误:找不到名为“graphframes”的模块

我该如何将其添加/导入到Databricks笔记本中?感谢任何帮助。


你安装了GraphFrames吗?可以查看这个链接 https://dev59.com/cKvka4cB1Zd3GeqPq0tp。安装方法请参考 https://pypi.org/project/graphframes/。 - Avinash Dalvi
3个回答

2
注意:默认情况下,Databricks上未安装“graphframes”软件包。
您需要显式安装该软件包。
您可以使用不同的方法安装软件包。
方法1:使用pip命令安装外部软件包。
语法:%sh / databricks / python3 / bin / pip install<packagename>
%sh
/databricks/python3/bin/pip install graphframes

enter image description here

方法2:使用Databricks 库实用程序 语法:
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文档

笔记本输出:

enter image description here

希望这有所帮助。

0

graphframes 不是 Python 的默认依赖项。您应该安装此依赖项。


0

您需要安装graphframes模块,打开终端并输入 pip install graphframes


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接