title: PATH issues with homebrew-installed Python 2 and Python 3 on OSX
body: <p>I'm relatively new to programming and have searched 'til my fingertips were blue, but can't seem to find a solution to the problem I'm having.</p>
  
  <p>I have homebrew-installed versions of Python 2 and Python 3 on OSX and I can't seem to get the proper PATH/PYTHONPATH in my .bash_profile in order to be able to import modules properly in both versions in IDLE. I can, however, import modules when running Python 2 or Python 3 directly in a shell window. I am launching IDLE via terminal so it should properly initialize the paths.</p>
  
  <p>Here is my <code>.bash_profile</code>:</p>
  
  <pre><code>export PATH=/bin:/usr/local/bin:$PATH
  export PYTHONPATH=/Users/maverett/Documents/PyModules:/Users/maverett/Dropbox/matrix/:$PYTHONPATH
  </code></pre>
  
  <p>Here's what happens in all four cases, using numpy as an example module.</p>
  
  <p>Importing when running python2 in terminal works:</p>
  
  <pre><code>$ python2
  Python 2.7.5 (default, Jun 28 2013, 19:06:25) 
  [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import numpy as np
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Launching IDLE for Python 2 from terminal, I can also import numpy. However, when I compare <code>sys.path</code> in IDLE vs <code>sys.path</code> in terminal, they are different. I compared the lists to generate the differences and found:</p>
  
  <pre><code>&gt;&gt;&gt; InIdleNotInTerm 
  ['/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/bin']
  &gt;&gt;&gt; InTermNotInIdle
  []
  </code></pre>
  
  <p>So there is one extra directory in the IDLE path when running Python 2.</p>
  
  <p>The story is quite different for Python 3.</p>
  
  <pre><code>$ python3
  Python 3.3.2 (default, Jul  1 2013, 10:53:26) 
  [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import numpy as np
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>However, if I launch IDLE for Python 3 (by typing idle3 in terminal) and then try to import numpy, I get</p>
  
  <pre><code>&gt;&gt;&gt; import numpy as np
  Traceback (most recent call last):
    File "&lt;pyshell#1&gt;", line 1, in &lt;module&gt;
      import numpy as np
  ImportError: No module named 'numpy'
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Again, I compared <code>sys.path</code> in terminal and in IDLE and this time there are major differences:</p>
  
  <pre><code>&gt;&gt;&gt; pp(InIdleNotInTerm)
  ['/Library/Frameworks/Python.framework/Versions/3.3/bin',
   '/Library/Frameworks/Python.framework/Versions/3.3/lib/python33.zip',
   '/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3',
   '/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/plat-darwin',
   '/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/lib-dynload',
   '/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages']
  &gt;&gt;&gt; pp(InTermNotInIdle)
  ['/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/distribute-0.6.45-py3.3.egg',
   '/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.3.1-py3.3.egg',
   '/usr/local/lib/python3.3/site-packages/distribute-0.6.45-py3.3.egg',
   '/usr/local/lib/python3.3/site-packages/pip-1.3.1-py3.3.egg',
   '/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python33.zip',
   '/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3',
   '/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/plat-darwin',
   '/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/lib-dynload',
   '/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages',
   '/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-0.6c11-py3.3.egg-info',
   '/usr/local/lib/python3.3/site-packages',
   '/usr/local/lib/python3.3/site-packages/setuptools-0.6c11-py3.3.egg-info']
  </code></pre>
  
  <p>Any idea what's going on? A few other things I've tried:</p>
  
  <p>Changing .bash_profile to</p>
  
  <pre><code>export PATH=/bin:/usr/local/bin:$PATH
  export PYTHONPATH=/Users/maverett/Documents/PyModules:/Users/maverett/Dropbox/matrix/:/usr/local/lib/python3.3/site-packages/:$PYTHONPATH
  </code></pre>
  
  <p>results in being able to import modules in Python 3 in terminal and in IDLE, but breaks imports for Python 2 (because it tries to import the Python 3 versions!)</p>
  
  <p>Launching IDLE for Python 3 via terminal from <code>python3.3/site-packages/</code> results in being able to properly import everything, but I don't want to do this every time I launch Python 3.</p>
  
  <p>Any thoughts or ideas you have would be greatly appreciated! Thanks :)</p>