报错
Exception: Python in worker has different version 2.7 than that in driver 3.7,
PySpark cannot run with different minor versions.
Please check environment variables PYSPARK_PYTHON and PYSPARK_DRIVER_PYTHON are correctly set.
找到对应的python环境
(base) xin:~ xin$ which python
/Users/xin/anaconda3/bin/python
设置一下
os.environ["PYSPARK_PYTHON"]="/Users/xin/anaconda3/bin/python"
os.environ["PYSPARK_DRIVER_PYTHON"]="/Users/xin/anaconda3/bin/python"