Thank you.
John-Wilkinsons-iMac:p31summerfield wilkinson$ which python
/opt/local/bin/python


On May 24, 2011, at 9:27 AM, Walter Prins wrote:

> The problem likely is as intimated by the error message that your python 
> interpreter not called "/usr/local/bin/python3.1" but I'd offhand guess, 
> probably "/usr/local/bin/python".  (Indeed, you run the interpreter yourself 
> as "python" not "python3.1" so you should not be using "python3.1" in your 
> script header.)
> 
> To check, try:
> 
> John-Wilkinsons-iMac:~ wilkinson$ which python
> 
> Assuming you have the "which" command this will tell you which version of 
> python is used then you do e.g. "python hello.py."  Then change the hash-bang 
> (#!) header in your script to match the location you found.  (If you dont 
> have "which", you can also try "whereis" or "env" or "type -a".)
> 
> Note, some people use the following hash-bang header in preference of a hard 
> coded path as I've suggested above, as follows:
> 
> #!/usr/bin/env python
> 
> /usr/bin/env goes off and looks up the appropriate path for (in this case) 
> the "python" interpreter, then passes control to that, thereby making your 
> script a little less dependent on a hardcoded paths present on your system.  
> This works provided of course that "env" is available and found in /usr/bin.  
> (Thought I'd mention that in case you wanted to use that instead/try it.)
> 
> Disclaimer: I don't have a Mac, the above is basically general advice which 
> should however work any Unix'ish or GNU'ish system, including I believe on 
> the Mac providing Apple's not changed things that I'm not aware of.
> 
> Hope that helps
> 
> Walter
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to