I am trying to setup Sublime Text 2 so that the build command correctly runs Python3 / Python3.3 scripts.
In this Python Tutorial, we will be setting up a development environment in Sublime Text 3. We will walk through how to install Sublime Text, install Package Control, install Packages, and much more. A really useful book for the Python developer who wants to get productive quickly with a new SublimeText install. I've been using SublimeText for a while, and had figured out the hard way how to set it up with the right collection of add-ons for Python productivity. How to Setup Sublime Text 3 with Python and interactive mode. A better Python REPL. Python 3 Basics - 1.0 - Setup of Python 3 (Mac) - Duration: 11:57. Pileofcode 29,003 views.
I have installed Python 3.3 via the installer obtained from python.org and installed Sublime Text 2 via the Sublime Text 2 installer.
Following this I added a custom build entry called:
into Sublime Text 2's Python folder with the following contents:
I'm getting the following error when trying to run the script:
I have read somewhere that symlinkng python3
from /usr/bin
might fix the issue but after creating the symlink in /usr/bin
through Finder, Sublime Text still cannot build as it gets a permissions error.
What is the best way to set Sublime Text 2 up to allow for running Python3 scripts?
[edit]
If I place the PATH for the python3 simlink generated by install, Sublime Text 2 can build the script,
But when I tried adding the PATH to the ~/.MacOSX/environment.plist as advised without the defined PATH I get the error. Could anyone point out why this is not working?
Bryan Luby
4 Answers
Add 'path': '/Library/Frameworks/Python.framework/Versions/3.3/bin/'
to your Python3 build file. Mine looks like this:
Note: Make sure the path to Python3 is relative to your machine - that was true for mine
I gave the complete path to python3 to get this to work:
grg♦
How To Setup Sublime Text For Python Mac Replica
The issue is the normal OSX one that GUI Applications do not read your shell profiles etc and so just have the path inherited from the Workspace.
The way to fix this is to add the path in ~/.MacOSX/environment.plist
That is add a key string pair for PATH e.g.
You will need to logout and login or possibly reboot for this to work.
MarkMark
Sister site stackoverflow has few entries with explanations regarding the issue of setting PATH environment variables for GUI based applications. Some claim that environment.plist works and others claim it doesn't and recommend using launched.conf.
Mac OS X Lion no longer recognizes environment.plist, Environment variables in Mac OS X, and Set environment variables on Mac OS X Lion. Also this answer has more details about launched.conf format.
If it doesn’t, then you will get the root domain in the first column itself. Note: This works well when you have all the URLs that have in the beginning.