I'm a newbie and I'm still stumped...

Jussi Piitulainen jpiitula at ling.helsinki.fi
Mon Aug 3 05:49:14 EDT 2015


Dwight GoldWinde quotes himself:
>
>> Okay, thank you, Dave, so I got the following info: type $(which
>> python3)
>> /Library/Frameworks/Python.framework/Versions/3.4/bin/python3 is
>> /Library/Frameworks/Python.framework/Versions/3.4/bin/python3
>>
>> But I can¹t figure out what short of ³usr² statement
>> (e.g. #!/usr/bin/env python3) I need to point it there. Whatever I
>> tried, still gives me version 2.

How are you launching your script? If your method involves clicking some
pretty picture or something similar, you may be bypassing /usr/bin/env
altogether and relying on some association of file types in Mac OS. Then
you need to investigate file properties in Finder, or something like
that. It should be safe to change the association for that individual
script but not necessarily for all files with the same extension.

If your method is to type "python scriptname" at the shell prompt, you
are definitely bypassing /usr/bin/env and specifying the default python
as the one to use. Solution: type "python3 scriptname" instead. (A more
advanced solution: make scriptname executable and type "./scriptname"
instead. This one uses /usr/bin/env to find the interpreter.)

(You could try "#!/usr/bin/env aintgotnosuch" as your script's hashbang
line to see if it even matters what that line says. Check first that you
don't happen to have a program named "aintgotnosuch" in your path.)



More information about the Python-list mailing list