Difference between preinstalled Python and MacPorts Python on Mac OS X
While trying to install PIL for Python 2.6 on Mac OS X Snow Leopard, I ran into multiple issues and multiple solutions. So I thought开发者_如何学运维 of getting basics cleared.
What is the difference between installing Python using MacPorts and using the one that comes with the system and what are the advantages?
So in my situation, for Django, I was using the system provided Python. But for GAE, I (apparently) need to get Python provided by MacPorts if I want to use PIL. Does it mean that my Django scripts will break?
On other thoughts, is there a standard way of doing this installation that will cover all the possible scenarios?
There's a lot of good advice here on how to fix your problem, but not many people are answering your questions. The major difference between these various versions is where they place and load their binaries and library modules. The diaspora of Mac python installers could place things in /opt/local/Library/Frameworks/Python.framework/Versions/*
or /Library/Frameworks/Python*
, /usr/local/python/*
, etc etc.
None of these versions is inherently different or better than another (aside from the differences indicated by their python version numbers), except for the ease of getting the appropriate install method to recognize it and associate future packages with the appropriate version installed. If you stick to installing by one method (compiling yourself, using macports or homebrew, or grabbing pre-compiled .dmgs), the likelyhood of getting your libraries lined up is far greater.
When working on a mac, I prefer not to use the built-in python (which tends to be rather old) and instead use macports. So, I will install python26 and python libraries alway with macports. If a package is unavailable, I make sure to to a which python
to see which interpreter I'm using, and if it's not the appropriate version, I'll use macports' python_select
option to make sure I've got the right one. Then, I'll go ahead and install with pip on that python version.
The most important thing is making sure you have the right version of python lined up with the right libraries you want to use. If worse comes to worst and you've found where your package manager installed the modules, one could append it to the sys.path
list to allow loading from whichever interpreter you're using -- though I find that rather messy.
I believe they are the same. I have been using a macports version with no problems. But I went through the same difficulties as you getting PIL working for GAE, and I have a few steps which will lead you to success:
- Install macports
- sudo port install py26-pil +universal
- In aptana/pydev you need to configure a new interpreter, so in preferences->pydev->interpreter-python, click new then browse to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
- once it has configured the new interpreter you are ready to go :)
default preinstalled are quite old. some preinstalled libraries such as Twisted works well with it. but as soon as you add more extra libraries such as PyQt4 then things are started to get ugly. you can of course compile those additional libraries from their source.
with MacPorts everything is simplified. you just have to fetch Python runtime which will be compatible with their version of PyQt4, Twisted, etc. Not sure about Django though since i never use it.
and if you're editing .py using MacVim, using MacPorts version of MacVim will gives you extra compability for Python (with syntax highlighting, etc)
精彩评论