码迷,mamicode.com
首页 > 其他好文 > 详细

Conda 搭建jupyter notebook + pyspark

时间:2017-03-31 16:33:28      阅读:2415      评论:0      收藏:0      [点我收藏+]

标签:master   size   pytho   yarn   mit   conf   driver   json   应该   

 python3.6不支持pyspark, 好在用的是Anaconda这种神器,可以随意切换python版本。因为我的Spark是1.6的,所以python2.7应该是可以的。

首先

conda create -n py27 python=2.7 anaconda
source activate py27
conda install python=2.7
首就将当前的python环境切换到了2.7, 然后修改

/usr/local/share/jupyter/kernels/pyspark/kernel.json

{
"display_name": "PySpark",
"language": "python",
"argv": [ "/home/.../anaconda3/envs/py27/bin/python", "-m", "ipykernel", "-f", "{connection_file}" ],
"env": {
"SPARK_HOME": "/.../spark/spark-1.6.0-bin-hadoop2.6/",
"PYSPARK_PYTHON": "/.../anaconda3/envs/py27/bin/python",
"PYSPARK_DRIVER_PYTHON": "ipython2",                       
"PYTHONPATH": "/.../spark/spark-1.6.0-bin-hadoop2.6/python/:/.../spark/spark-1.6.0-bin-hadoop2.6/python/lib/py4j-0.9-src.zip",
"PYTHONSTARTUP": "/.../spark/spark-1.6.0-bin-hadoop2.6/python/pyspark/shell.py",
"PYSPARK_SUBMIT_ARGS": "--name pyspark --master yarn --deploy-mode client --conf spark.executor.instances=8 --conf spark.executor.memory=5g --conf spark.driver.memory=8g --conf spark.sql.caseSensitive=false --conf spark.yarn.queue=queue1 pyspark-shell"
}
}

注意该文件路径不要改,会有程序到这个路径直接读取。

为了确保不会跑到别的python上去,将PATH变量也修改一下:export PATH=/.../anaconda3/envs/py27/bin/python:$PATH

 

Conda 搭建jupyter notebook + pyspark

标签:master   size   pytho   yarn   mit   conf   driver   json   应该   

原文地址:http://www.cnblogs.com/jiang-Xin/p/6651981.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!