有没有关于如何正确安装Homebrew的Python以及pip、virtualenv、virtualenvwrapper等的权威指南?
我已经阅读了以下几页:
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
我安装了OSX10.8 (Mountain Lion) DP3,并安装了XCode命令行工具。
我也安装了XQuartz,以防万一(10.8没有提供)。
然后我运行:
brew install python --universal --framework我将以下内容添加到我的~/.bash_profile中
export PATH="/usr/local/bin:/usr/local/share/python:${PATH}"然后我运行:
sudo easy_install pip这看起来很管用。
我检查pip的安装位置:
Victors-MacBook-Pro:~ victorhooi$ which pip
/usr/local/bin/pip但是,当我尝试通过pip安装包时,我得到一个错误,抱怨无法写入/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我的理解是,Homebrew的Python将安装到它自己的站点包中,而我不需要在文件系统树上执行奇怪的chown来使其正常工作?
干杯,维克多
发布于 2012-06-07 17:16:26
作为一个亲身体验过你的人,请先开始使用虚拟环境,然后再使用pip,然后再使用其他工具。他们令人敬畏,并将解决这个问题和许多未来的问题。
发布于 2012-08-15 16:36:00
同时,homebrew的python也在进化:
通过brew安装的框架Python不再尝试写入/Library/Python.
您在.bashrc中的路径是正确的(并且仍然需要)。
发布于 2012-09-29 05:19:14
现在已经发布了Mountain Lion 10.8.2,并且我已经从Lion安装了一个遗留的Python 2.7,但一切都不能正常工作。不管我怎么尝试,Python都想访问/Library/..不是很好。简单的解决方案是brew uninstall python,然后是brew install python,它在ML上解决了几乎所有与Python相关的问题。
https://stackoverflow.com/questions/10928914
复制相似问题