没有名为graphframes的模块Jupyter Notebook

问题描述:

我正在遵循安装指南,但是在使用

I'm following this installation guide but have the following problem with using graphframes

from pyspark import SparkContext
sc =SparkContext()
!pyspark --packages graphframes:graphframes:0.5.0-spark2.1-s_2.11
from graphframes import *

--------------------------------------------------- ---------------------------- ImportError Traceback(最近的呼叫 最后)在() ----> 1从graphframes导入*

--------------------------------------------------------------------------- ImportError Traceback (most recent call last) in () ----> 1 from graphframes import *

ImportError:没有名为graphframes的模块

ImportError: No module named graphframes

我不确定是否可以通过以下方式安装软件包. 但我会感谢您的建议和帮助.

I'm not sure wether it is possible to install package on the following way. But I'll appreciate your advice and help.

好问题!

打开您的bashrc文件,然后键入export SPARK_OPTS="--packages graphframes:graphframes:0.5.0-spark2.1-s_2.11".保存bashrc文件后,将其关闭并键入source .bashrc.

Open up your bashrc file, and type export SPARK_OPTS="--packages graphframes:graphframes:0.5.0-spark2.1-s_2.11". Once you saved your bashrc file, close it and type source .bashrc.

最后,打开笔记本并输入:

Finally, open up your notebook and type:

from pyspark import SparkContext
sc = SparkContext()
sc.addPyFile('/home/username/spark-2.3.0-bin-hadoop2.7/jars/graphframes-0.5.0-spark2.1-s_2.11.jar')

之后,您也许可以运行它.

After that, you may able to run it.