How to start a Spark Shell using pyspark in Windows?

Alex picture Alex · Jul 28, 2015 · Viewed 16.8k times · Source

I am a beginner in Spark and trying to follow instructions from here on how to initialize Spark shell from Python using cmd: http://spark.apache.org/docs/latest/quick-start.html

But when I run in cmd the following:

C:\Users\Alex\Desktop\spark-1.4.1-bin-hadoop2.4\>c:\Python27\python bin\pyspark 

then I receive the following error message:

File "bin\pyspark", line 21 
export SPARK_HOME="$(cd ="$(cd "`dirname "$0"`"/..; pwd)" 
SyntaxError: invalid syntax

What am I doing wrong here?

P.S. When in cmd I try just C:\Users\Alex\Desktop\spark-1.4.1-bin-hadoop2.4>bin\pyspark

then I receive ""python" is not recognized as internal or external command, operable program or batch file".

Answer

maxymoo picture maxymoo · Jul 28, 2015

You need to have Python available in the system path, you can add it with setx:

setx path "%path%;C:\Python27"