TextWrangler running Python 2.7 after I removed it from my Mac
As the root of your question seems to be, "How can I run scripts via TextWrangler in Python 3 (rather than 2.7)?", I'll provide an answer to that. (Please let me know if I've misunderstood).
As I'm not sure how you've chosen to install Python 3, I'd suggest working with Homebrew and installing python
and python3
with the command brew install python python3
once you've gotten Homebrew up and running.
Homebrew defaults to installing software to /usr/local/bin/
, so make sure that is present in your PATH
variable.
Once Python 3 is installed, you can create a new TextWrangler document and enter the following code to test:
#!/usr/bin/env python3
import sys
print(sys.version)
Then, run the script by going to #! -> Run in the TextWrangler menu (see attached image).
The output (shown in a new window by default) should give you your system and Python information. In my case, the results were:
=========================================================================
Feb 18, 2016, 15:07:45
untitled text
-------------------------------------------------------------------------
3.5.1 (default, Dec 7 2015, 21:59:10)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)]
Alternately, you can directly input the path to your python3
executable in line 1 (/usr/local/bin/python3
is the default for Homebrew).