Viewed 516 times
Setting up Sublime Text for Python Developers – Lesson #1. Setting up a Python Development Environment in Sublime Text - Duration. (Setting up the Environment 2): Sublime Text - Duration.
I've seen questions similar to this but haven't found a workable answer. I'm looking to learn more about Python coding, I've been coding a lot with Ruby, but would like to use Python for some 3rd Party modules which don't seem to have a Ruby equivalent. RVM and gems made 3rd party really easy to work with, is there an equivalent for Python? I've installed Python through Macports and Homebrew, and have tried to install 3rd party modules through Macports ('sudo port install') and pip. Although the modules seem to install successfully, I can't get any non-standard modules to run in Sublime Text.
On the Sublime Text side, I managed to get Python to build by creating a new build system based on suggestions from here
Or do you mean text-to-speech. Voice to text recognition software mac.
and also by using the Sublime-REPL package. I've also read that virtualenv is a common way to utilize 3rd party modules, as it will prevent conflicts.
So my question is, How can I get Python to run in Sublime Text like Ruby did. How can I set up Sublime text so that it points to the correct directory where 3rd party modules are installed, so that it can build something that includes one of these modules. I'm guessing there are multiple ways to do this, I'm just looking for the most straightforward approach.
Any tips appreciated, thanks in advance
jackmac92jackmac92
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Browse other questions tagged pythonpipsublimetextsublimetext3macports or ask your own question.
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.
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:
What Does 3 Mean
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 Luby4,79711 gold badge1919 silver badges3232 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:
grg♦145k2525 gold badges229229 silver badges340340 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.
MarkMark20.9k1212 gold badges6060 silver badges9898 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.
![Python Python](/uploads/1/2/6/0/126082423/228705633.gif)
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.
Community♦
ismailismail