问题
I know there are many questions on SO, and forum and blog posts around the web, but I keep running into the same problems. I'm trying to install PIL to use it for the app engine imaging api. In the api overview, google suggests installing it from pythonmac.org.
When I try to install the dmg provided there, it tells me that it requires python 2.5 to be installed as the system python. A little googling around for this error, pointed me to this SO question: How to install PIL on Mac OSX 10.5.8 for Google App Engine?. In the first answer for that, I did step 1, I installed macports. Then, step 2 told me to run sudo port install python25
.
This gave me the following error:
Error: org.macports.activate for port expat returned: Image error: /opt/local/bin/xmlwf already exists and does not belong to a registered port. Unable to activate port expat. Use 'port -f activate expat' to force the activation.
Error: Failed to install expat
Please see the log file for port expat for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_expat/expat/main.log
Error: The following dependencies were not installed: gettext expat libiconv ncurses libedit openssl zlib python_select sqlite3
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port python25 failed
For the full output of macports, see this pastebin
When that didn't work out, a bit more googling brought me to this blog post. I installed libjpeg, as it suggests. The following steps it suggests are:
Download PIL from http://effbot.org/downloads/Imaging-1.1.7.tar.gz. (Remove PIL first if installed already.)
In the unpacked folder: python setup.py build --force sudo python setup.py install
But when I tried running python setup.py build --force, I got this error:
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
lipo: can't figure out the architecture type of: /var/folders/q_/wgr019b53rx9b2lr3y7867bm0000gn/T//ccJY6hPI.out
error: command 'gcc-4.2' failed with exit status 1
for the full output, check this pastebin.
There are some other things I've tried, and I'll edit those in, but I want to get this posted asap. thx in advance.
回答1:
One approach is Pillow. The Plone folks got sick of exactly these types of headaches and forked PIL.
Pillow is a drop-in replacement for PIL that isn't a nightmare to build and install.
来源:https://stackoverflow.com/questions/14654781/installing-pil-on-osx-mountain-lion-for-google-app-engine