python能装在mac上吗_试图在Mac上正常安装Python吗?

I have Mac OSX 10.5.8 with Xcode installed. I want to avoid MacPorts and want to just get a solid Python install foundation so I can then move on to mess with Django and other things. I want to use Buildout with my Python applications.

I have installed binary Python 2.6.4 from the official site and installed this. Following other advice I have put this in my ~/.bash_profile file:

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

So, when I do a which python it shows /usr/local/bin/python. And, when I do a python -V it shows Python 2.6.4 - this all seems great.

I've looked inside the /usr/local/bin/ folder and, among other things, I seem to have the correct stuff pointing to Python 2.6:

python -> ../../../Library/Frameworks/Python.framework/Versions/2.6/bin/python

BUT, when I do an easy_install of virtualenv (that I want to use with Buildout) it seems to install it in /Library/Python/2.5/site-packages/virtualenv-1.4.3-py2.5.egg

...which is Python 2.5? Also, when I setup my Buildout folder using virtualenv, in there the .Python symlink is going to:

.Python -> /System/Library/Frameworks/Python.framework/Versions/2.5/Python

Why is this? I don't understand this. How can I get it all pointing to the correct Python 2.6?

Thank you so much for any answers, it's annoying the hell out of me. Cheers.

解决方案

Firstly, there's absolutely no need to install a new version of Python to work on Django in Leopard. The stock Python 2.5 works absolutely fine, and Django is 100% compatible with that version.

Secondly, if you do want to use virtualenv with a different version of Python other than the system default, you simply need to tell it when you create the virtualenv:

virtualenv --python=/path/to/python/2.6 virtualenvname

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值