[IPython-user] ipython/matplotlib question

Robert Kern robert.kern at gmail.com
Wed Dec 6 15:13:21 CST 2006


belinda thom wrote:
> On Dec 4, 2006, at 1:03 PM, Robert Kern wrote:
> 
>> You need to make sure that the python executable in the #! line of  
>> the main
>> ipython script is pythonw2.4 (or equivalently, the full path to
>> /Library/Frameworks/Python.framework/Versions/Current/Python), not  
>> just python2.4.
>>
>> -- 
>> Robert Kern
> 
> Thanks Robert.
> 
> I tried your suggestion, which is (partially) successful.
> 
> Upon changing the header in ipython:
> 
>    5 % head ipython
>    #!/opt/local/bin/pythonw2.4
>    # -*- coding: utf-8 -*-
>    """IPython -- An enhanced Interactive Python
>    [snip]
> 
> I get:
> 
>    4 % ipython
>    tcsh: Unmatched ".
> 
> If i put simply "pythonw" in the top line, the same thing happens.
> 
> However, if I run:
> 
>    23 % pythonw /opt/local/bin/ipython -pylab
>    Python 2.4.3 (#1, Nov  9 2006, 12:26:57)
>    Type "copyright", "credits" or "license" for more information.
>    [snip]
>    IPython 0.7.2 -- An enhanced Interactive Python.
>    [snip]
>    In [1]: plot([1,2,3])
>    Out[1]: [<matplotlib.lines.Line2D instance at 0x4f010a8>]
> 
> I get interactive plot figures as I'd like.
> 
> Any clue why I can't change the header in the expected way?

MacPorts' Python is different from the official distribution. Probably their
pythonw script does not have the fixes that the official one has. Or tcsh simply
doesn't like it. There are two ways to fix this:

* Use #!/usr/bin/env /opt/local/bin/pythonw

* or the full path to /Library/Frameworks/Python.framework/Versions/Current/Python

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the IPython-user mailing list