首页 > 代码库 > windows下pycharm远程调试pyspark

windows下pycharm远程调试pyspark

参考http://www.mamicode.com/info-detail-1523356.html
1.远端执行:vi /etc/profile
添加一行:
PYTHONPATH=$SPARK_HOME/python/:$SPARK_HOME/python/lib/py4j-0.9-src.zip
或者PYTHONPATH=$SPARK_HOME/python/:$SPARK_HOME/python/lib/py4j-0.8.2.1-src.zip
2.安装pip 和 py4j
下载pip-9.0.1.tar.gz和py4j-0.10.4.tar.gz
解压pip-9.0.1.tar.gz和py4j-0.10.4.tar.gz,cd到解压目录执行:sudo python setup.py install
3.本地Pycharm设置
File > Settings > Project Interpreter:
Tools > Dployment > Configuration:
4.运行代码中加入:
import os
import sys
os.environ[‘SPARK_HOME‘] = "/opt/cloudera/parcels/CDH-5.9.1-1.cdh5.9.1.p0.4/lib/spark"
sys.path.append("/opt/cloudera/parcels/CDH-5.9.1-1.cdh5.9.1.p0.4/lib/spark/python")

windows下pycharm远程调试pyspark