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.
PirosBOX:~ piros$ python -V Python 2.5.1
Have OSX 10.5.8 and i write django apps fine :D The important thing is to get the SVN release of Django, better!
Personally, what I do is leave my system python completely as is.
I use the following to install 2.4, 2.5 and 2.6 versions of Python:
Use a buildout from the plone collective to get python2.{4,5,6} installed with easy_install and PIL (including libjpeg support)
Checkout the python buildout files from the plone collective. I like to put it in /home/dev/python-buildout
Add a new local.cfg file into the src directory. This is where you specify what you want to build. Use the following in your buildout file:
Bootstrap with your system python and then run the buildout.
When everything has been compiled, you should have a new python binaries here:
To use them, either add the bin directory to your path, or source the 'activate' script in the bin directory, which will set it as the active python in your current shell
For each project I'm working on, I tend to create a new virtual environment, using no-site-packages and the appropriate version of Python.
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:
I found the following two links particularly useful when I had to do it:
http://jessenoller.com/2009/03/16/so-you-want-to-use-python-on-the-mac/
http://blog.captnswing.net/2009/04/19/python-mod_wsgi-64bit-mac-os-x-105/
When you install a new Python instance, you also need to install a new copy of
easy_install
for it. Follow the instructions for either the classic setuptools version or the newer Distribute. In either case, for the python.org 2.6.4 on OS X theeasy_install
script will be installed in/Library/Frameworks/Python.framework/Versions/2.6/bin
which should come before/usr/bin
on your shell$PATH
.