title: sc is not defined in pyspark
body: <p>SparkContext function is returning error in pyspark in cmd and Jupyter</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  NameError: name 'sc' is not defined
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>&gt;&gt;&gt; from pyspark import SparkContext
  &gt;&gt;&gt; sc = SparkContext()
  </code></pre>
  
  <p>But still showing the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "c:\spark\python\pyspark\context.py", line 115, in __init__
      SparkContext._ensure_initialized(self, gateway=gateway, conf=conf)
    File "c:\spark\python\pyspark\context.py", line 275, in _ensure_initialized
      callsite.function, callsite.file, callsite.linenum))
  **ValueError: Cannot run multiple SparkContexts at once; existing SparkContext(app
  =PySparkShell, master=local[*]) created by getOrCreate at c:\spark\bin\..\python
  \pyspark\shell.py:43**strong text****
  </code></pre>
  
  <p>How to solve the problem?</p>