Is there a definitive guide for how to install Homebrew's Python properly, along with pip, virtualenv, virtualenvwrapper etc.?
I've read the following pages:
https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
http://osxastrotricks.wordpress.com/2012/05/02/python-setup-with-homebrew/
http://skipperkongen.dk/2011/11/13/installing-django-in-virtual-environment-on-mac/
http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/
http://youshoulddoityourself.blogspot.com.au/2010/11/test.html
I have OSX 10.8 (Mountain Lion) DP3, and I installed the XCode Command Line Tools.
I also installed XQuartz as well, just in case (10.8 doesn't provide it).
I then ran:
brew install python --universal --framework
I added the following to my ~/.bash_profile
:
export PATH="/usr/local/bin:/usr/local/share/python:${PATH}"
I then ran:
sudo easy_install pip
which seemed to work.
I check where pip's installed:
Victors-MacBook-Pro:~ victorhooi$ which pip
/usr/local/bin/pip
However, when I try to pip install packages, I get an error complaining about not being able to write to /Library/Python/2.7/site-packages:
running install_lib
creating /Library/Python/2.7/site-packages/yolk
error: could not create '/Library/Python/2.7/site-packages/yolk': Permission denied
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/Users/victorhooi/build/yolk/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/gg/m37t1rkx4zj7z54ls487jfc40000gn/T/pip-ap7LSB-record/install-record.txt failed with error code 1 in /Users/victorhooi/build/yolk
Storing complete log in /Users/victorhooi/Library/Logs/pip.log
My understanding was that Homebrew's Python would install into it's own site-packages, and I wouldn't need to do weird chown's all over the filesystem tree to get things to work?
Cheers, Victor
To use pip, first install a custom version of Python 2. pip is then installed with it. You can then use the pip command to create a virtualenv and install modules.
site-packages is the target directory of manually built Python packages. When you build and install Python packages from source (using distutils, probably by executing python setup.py install ), you will find the installed modules in site-packages by default.
[email protected] — Homebrew Formulae.
Meanwhile, homebrew's python has evolved:
/Library/Python
.Your PATH in the .bashrc is correct (and still needed).
Please, as someone who has been exactly where you are, start using virtual environments first, then pip and the rest. They are awesome, and will solve this and many future problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With