Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Big Data Hadoop & Spark by (11.4k points)
I'm trying to run a script in the pyspark environment but so far I haven't been able to. How can I run a script like python script.py but in pyspark?

1 Answer

0 votes
by (32.3k points)

For PySpark 2.0+, just execute script file in environment variable PYTHONSTARTUP, so you can run:

PYTHONSTARTUP=code.py pyspark

Also, note that running python applications through pyspark is not supported as of Spark 2.0.

So in that case you can do this:

./bin/spark-submit mypythonfile.py

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...