1、添加环境变量:
2、添加py4j.zip和pyspark.zip
File->Setting->Project Structure->Add Content Root
参考目录:d:\spark-1.6.0-bin-hadoop2.6\python\lib
3、修改spark-defaults.conf
在spark目录下找到配置文件spark-defaults.conf,添加一行:
spark.jars.packages org.apache.spark:spark-streaming-kafka_2.10:1.6.0
我的spark版本是1.6的,所以是
org.apache.spark:spark-streaming-kafka_2.10:1.6.0
https://stackoverflow.com/questions/35560767/pyspark-streaming-with-kafka-in-pycharm