Seguo questo collegamento http://ramhiser.com/2015/02/01/configuring-ipython-notebook-support-for-pyspark/ per creare PySpark Profile per IPython.Crea profilo PySpark per IPython
00-pyspark-setup.py
# Configure the necessary Spark environment
import os
import sys
spark_home = os.environ.get('SPARK_HOME', None)
sys.path.insert(0, spark_home + "\python")
# Add the py4j to the path.
# You may need to change the version number to match your install
sys.path.insert(0, os.path.join(spark_home, '\python\lib\py4j-0.8.2.1-src.zip'))
# Initialize PySpark to predefine the SparkContext variable 'sc'
execfile(os.path.join(spark_home, '\python\pyspark\shell.py'))
Il mio problema quando si digita sc
in ipython-notebook, ho ottenuto ''
dovrei vedere un risultato simile al <pyspark.context.SparkContext at 0x1097e8e90>.
Qualche idea su come risolverlo?
Cosa stai cercando di ottenere. Dove si verifica il problema nel tuo codice? – Rias
@Rias Ho aggiornato la mia domanda –
In Python 3 è stato rimosso execfile in modo che l'ultima riga debba essere modificata in exec (aperto (os.path.join (spark_home, '\ python \ pyspark \ shell.py')). Read()). –