我正在尝试将 IPython 笔记本与 Apache Spark 1.4.0 一起使用。我已经按照下面的 2 教程来设置我的配置
Installing Ipython notebook with pyspark 1.4 on AWS
和
Configuring IPython notebook support for Pyspark
配置完成后,相关文件中的几段代码如下:
1.ipython_notebook_config.py
c=get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser =False
c.NotebookApp.port = 8193
2.00-pyspark-setup.py
import os
import sys
spark_home = os.environ.get('SPARK_HOME', None)
sys.path.insert(0, spark_home + "/python")
# Add the py4j to the path.
# You may need to change the version number to match your install
sys.path.insert(0, os.path.join(spark_home, 'python/lib/py4j-0.8.2.1-src.zip'))
# Initialize PySpark to predefine the SparkContext variable 'sc'
execfile(os.path.join(spark_home, 'python/pyspark/shell.py'))
我还将以下两行添加到我的 .bash_profile 中:
export SPARK_HOME='home/hadoop/sparl'
source ~/.bash_profile
然而,当我跑
ipython notebook --profile=pyspark
它显示消息:无法识别的别名 '--profile=pyspark' 它可能没有效果
看来笔记本没有成功配置pyspark
有谁知道如何解决它?非常感谢你
以下是一些软件版本
ipython/Jupyter:4.0.0
Spark 1.4.0
AWS EMR:4.0.0
python :2.7.9
顺便说一下,我已阅读以下内容,但它不起作用
IPython notebook won't read the configuration file
最佳答案
Jupyter 笔记本没有配置文件的概念(就像 IPython 那样)。使用不同配置启动的推荐方式是例如:
JUPTYER_CONFIG_DIR=~/alternative_jupyter_config_dir jupyter notebook
另请参阅 issue jupyter/notebook#309 ,您将在其中找到描述 how to set up Jupyter notebook with PySpark without profiles or kernels 的注释。
关于python - 在 AWS EMR v4.0.0 上使用 Pyspark 配置 Ipython/Jupyter 笔记本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32796108/