Skip to content

Instantly share code, notes, and snippets.

@CarlosGrohmann
Forked from patriciogonzalezvivo/PythonSetup.md
Last active February 10, 2017 01:38
Show Gist options
  • Save CarlosGrohmann/f6b249d61b115949a980930410c5a28e to your computer and use it in GitHub Desktop.
Save CarlosGrohmann/f6b249d61b115949a980930410c5a28e to your computer and use it in GitHub Desktop.
How to install Python correctly on Mac OSX (adapted from original)

Install Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Add PATH to ~/.bash_profile

export PATH=/usr/local/bin:$PATH

Install Python

brew install python

Add PATH to ~/.bash_profile

export PATH=/usr/local/share/python:$PATH

Install helpful modules

brew install gcc
brew install freetype

pip install virtualenv
pip install virtualenvwrapper
pip install numpy
pip install scipy
pip install matplotlib
pip install ipython[all]

QT for Python

For QT integration you need to download QT SDK and then PyQT

brew install qt
brew install pyqt

Add the following to your .bash_profile:

export PATH=/usr/local/opt/qt5/bin:$PATH
export PYTHONPATH=/usr/local/lib/python:$PYTHONPATH

Keep installing dependences for PyQT

brew install zmq
pip install pyzmq
pip install pygments

Setting up Sublime

  1. Download and Install Sublime

  2. Install PackageControl. The simplest method of installation is through the Sublime Text console. The console is accessed via the ctrl+` shortcut or the View > Show Console menu. Once open, paste the appropriate Python code for your version of Sublime Text into the console. Once you install Package Control, restart ST3 and bring up the Command Palette (Command+Shift+P). Select "Package Control: Install Package", wait while Package Control fetches the latest package list.

  3. Install the PackageResourceViewer plugin. Open the Command Palette (Under Tools tab), type prv to bring up the PackageResourceViewer options, select Open Resource, then navigate down to Python and select the Python.sublime-build option

  4. Modify the code to point to the right brew paths. Ex:

{
	"env":{
		"PATH":"/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/bin:/usr/local/share/python",
		"PYTHONPATH":"/usr/local/lib/python:/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages"
		},
}
  1. From Package Control, install SublimeCodeIntel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment