Like lots of Apple fans around the world I've finally decided to upgrade my OS to Lion release. I have bought a new laptop and it was the case. I've waited for a weekend to prepared myself for sex. And it was it. Now I want to share my experience with you guys. For you not to spend to much time on those issues, I've did.
Anyway what I'm usually using is a Fresh 2.7 Python, Django, PIL, virtualenv and many many minor tools which exceed scopes of this article. I also use Eclipse IDE for Python Dev. So all this I had to install and make spinning till monday.
If anybody tells me that Macs do not have good tools for this. He will not be right. Maybe there some itches and scratches of head about:
"Why is not those things working" or "Why do they work not as preferred". But there always is a good "Googled" decision to handle that.
Anyway lets go to installing stuff.
Short brief Plan of out work:
1. Install Apple Development SDK + Xcode (free from Apple App Store).
2. Install Python (from python.org/getit).
3. Install Libraries needed for PIL (Libjpeg and Freetype support).
4. Install Django.
1. First of all! Mother of all Gods! We need Xcode and Mac Development tools provided from AppStore for Free. Let's download it and install it. If you have an apple store Account, of course. Actually here we do not need the whole bunch of stuff like Xcode or Dev tools except for GCC. And if you're advanced enough and have time to handle it... You should probably just install GCC, compiling it from sources for e.g. I'm not gonna spend time at those "low levels" and will simply install a set of packages that I may (or may not) need in future for dev.
After Xcode is Downloaded you should go to Applications of Lunchpad and hit Xcode icon. (They are actually only downloaded not installed yet. What a long time period, waiting for 1,6 Gigs App download form App Store.) Hit 'next', 'yes' and so on... Agree to everything and probably close some apps like for e.g. iTunes somewhat weirdly but true. Anyway lets continue to our next and main part. Those actions should already give us required GCC compiler for all our needs.
2. Next step is installing Python. We should get it from here, for e.g.: http://python.org/getit/. I've chosen Python 2.7.2 Mac OS X 64-bit/32-bit x86-64/i386 Installer (for Mac OS X 10.6 and 10.7). It gave latest stable 2.7.2 Python with idle for about 17 Mb more downloading.
DMG file has a simple enough installer that will ask you for root password and do all the stuff you need for you...
3. Support of jpeg, freetype and littlecms is missing, by default. You need to compile PIL with support of at least jpeg and freetype. In order to make ImageField in your django project support jpeg formats and Have ability to handle Captcha fields or different text with picture manipulations.
You may need to switch to 'sh' interpreter from standart 'bash' typing sh in command line. It handles ./congure and make install commends more gracefully (IMHO). And you may need 'sudo' to gain permissions to some system stuff here.
Will try to be brief here:
This will indicate successful installation of PIL and components.
4. Installing Django is easy now. Jut do it whatever way you prefer. Like sudo pip install django or
sudo easy_install django or even sudo pip install django==1.1, if you prefer oldies. :)
I prefer to use virtualenv 'your virtual env name here' --no-site-packages for every app of mine... So I'm not even installing Django to main system path as well... Btw if you've used virtualenv with you projects, like I did, prepare yourself. They need to be recreated. So be sure to save them with pip freeze. Maybe they will work if you pu them back to the same system path as they where... But there might be daemons here :).
I'll try to cover installation of MySQL environment on a "clean" Lion install in my next articles.
Anyway if you've found this article useful or think that I'm not right somewhere or even something less important... Feel free to drop me a comment here or contact me any available way. Thanks for reading so far and hope this will shorten your time while installing some things.
Anyway what I'm usually using is a Fresh 2.7 Python, Django, PIL, virtualenv and many many minor tools which exceed scopes of this article. I also use Eclipse IDE for Python Dev. So all this I had to install and make spinning till monday.
If anybody tells me that Macs do not have good tools for this. He will not be right. Maybe there some itches and scratches of head about:
"Why is not those things working" or "Why do they work not as preferred". But there always is a good "Googled" decision to handle that.
Anyway lets go to installing stuff.
Short brief Plan of out work:
1. Install Apple Development SDK + Xcode (free from Apple App Store).
2. Install Python (from python.org/getit).
3. Install Libraries needed for PIL (Libjpeg and Freetype support).
4. Install Django.
1. First of all! Mother of all Gods! We need Xcode and Mac Development tools provided from AppStore for Free. Let's download it and install it. If you have an apple store Account, of course. Actually here we do not need the whole bunch of stuff like Xcode or Dev tools except for GCC. And if you're advanced enough and have time to handle it... You should probably just install GCC, compiling it from sources for e.g. I'm not gonna spend time at those "low levels" and will simply install a set of packages that I may (or may not) need in future for dev.
After Xcode is Downloaded you should go to Applications of Lunchpad and hit Xcode icon. (They are actually only downloaded not installed yet. What a long time period, waiting for 1,6 Gigs App download form App Store.) Hit 'next', 'yes' and so on... Agree to everything and probably close some apps like for e.g. iTunes somewhat weirdly but true. Anyway lets continue to our next and main part. Those actions should already give us required GCC compiler for all our needs.
2. Next step is installing Python. We should get it from here, for e.g.: http://python.org/getit/. I've chosen Python 2.7.2 Mac OS X 64-bit/32-bit x86-64/i386 Installer (for Mac OS X 10.6 and 10.7). It gave latest stable 2.7.2 Python with idle for about 17 Mb more downloading.
DMG file has a simple enough installer that will ask you for root password and do all the stuff you need for you...
3. Support of jpeg, freetype and littlecms is missing, by default. You need to compile PIL with support of at least jpeg and freetype. In order to make ImageField in your django project support jpeg formats and Have ability to handle Captcha fields or different text with picture manipulations.
You may need to switch to 'sh' interpreter from standart 'bash' typing sh in command line. It handles ./congure and make install commends more gracefully (IMHO). And you may need 'sudo' to gain permissions to some system stuff here.
Will try to be brief here:
- Install JPEG support libraries:
- Download JPEG library source curl -O http://www.ijg.org/files/jpegsrc.v8c.tar.gz
- Extract tar -xvzf jpegsrc.v8c.tar.gz
- Switch to jpeg directory cd jpeg-8c
- Run ./confgure (I only made it work at 'sh' command prompt someway)
- Run make
- Run sudo make install
- Install Freetype support:
- Download Freetype library source curl -O http://ftp.igh.cnrs.fr/pub/nongnu/freetype/freetype-2.4.5.tar.gz
- Extract tar -xvzf freetype-2.4.5.tar.gz
- Enter to freetype directory cd freetype-2.4.5
- Run ./confgure (I only made it work at 'sh' command prompt someway)
- Run make
- Run sudo make install
- Actually install PIL:
- Type: sudo easy_install PIL
- End!
This will indicate successful installation of PIL and components.
4. Installing Django is easy now. Jut do it whatever way you prefer. Like sudo pip install django or
sudo easy_install django or even sudo pip install django==1.1, if you prefer oldies. :)
I prefer to use virtualenv 'your virtual env name here' --no-site-packages for every app of mine... So I'm not even installing Django to main system path as well... Btw if you've used virtualenv with you projects, like I did, prepare yourself. They need to be recreated. So be sure to save them with pip freeze. Maybe they will work if you pu them back to the same system path as they where... But there might be daemons here :).
I'll try to cover installation of MySQL environment on a "clean" Lion install in my next articles.
Anyway if you've found this article useful or think that I'm not right somewhere or even something less important... Feel free to drop me a comment here or contact me any available way. Thanks for reading so far and hope this will shorten your time while installing some things.
Comments
Post a Comment