I have removed Python 2.7 from my machine, using instructions provided here: How to uninstall Python 2.7 on a Mac OS X 10.6.4? (Using the top voted/accepted answer's instructions)
However, when I run my scripts using TextWrangler and look at some of the errors generated, it is still indicating that the error originated from Python 2.7 directory, which I have already deleted, and can't see it using ls.
Any idea how to force TextWrangler to run Python 3 instead?
I am running OS X Yosemite 10.10.5 on MacBook Pro mid 2012.
Best Answer
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
andpython3
with the commandbrew 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 yourPATH
variable.Once Python 3 is installed, you can create a new TextWrangler document and enter the following code to test:
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:
Alternately, you can directly input the path to your
python3
executable in line 1 (/usr/local/bin/python3
is the default for Homebrew).