Sublime Text 3 Builod For Mac Virtual Environment

Active4 years, 10 months ago

I am trying to setup Sublime Text 2 so that the build command correctly runs Python3 / Python3.3 scripts.

I have installed Python 3.3 via the installer obtained from python.org and installed Sublime Text 2 via the Sublime Text 2 installer.

How to set a path to virtual environment for sublime text 3 plugin to work correctly. Ask Question. Setting up a virtual environment for Django on a Mac. Launch sublime text 3 from terminal and build with activated conda environment. Using build systems, you can run files through external programs without leaving Sublime Text, and see the output they generate. Using Anaconda. To use anaconda you need to have installed Sublime Text 3 first, you can download it from it's official website in case that you didn't already. The easiest way to install anaconda is using Package Control for SublimeText 3, in case that you don't have installed Package Control already, just follow the installation guide in the Package Control website.

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,7971 gold badge19 silver badges32 bronze badges
markfknightmarkfknight

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

JSmythJSmyth

I gave the complete path to python3 to get this to work:

Sublime Text 3 Build For Mac Virtual Environment Python

grg
145k25 gold badges229 silver badges340 bronze badges
Ayush GoelAyush Goel

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
20.9k12 gold badges60 silver badges98 bronze badges

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.

Sublime Text 3 Build For Mac Virtual Environment

Community
ismailismail
Sublime Text 3 Builod For Mac Virtual Environment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged macostext-editorpythonsublimetext .