Mik*_*nce 26 python osx-snow-leopard python-imaging-library
我在Snow Leopard安装过程中安装了开发人员工具,对Snow Leopard进行了全新安装(使用擦除驱动器启动).
然后我安装了Python 2.6.2,取代了Snow Leopard默认的python 2.6.1.我试过通过以下方式安装PIL:
easy_installpippython setup.py build手动运行.所有产生相同的错误(链接到pip日志:http://drop.io/gi2bgw6).我已经看到其他人使用Snow Leopard默认python 2.6.1成功安装PIL,所以我不确定为什么我在使用2.6.2时遇到这么多麻烦.
Kyl*_*Fox 18
我遇到的问题是PIL正在针对PowerPC架构(-arch ppc)进行编译.
在setup/build/compile之前执行此操作:
export ARCHFLAGS="-arch i386"
Run Code Online (Sandbox Code Playgroud)
(假设你在i386上)
Ned*_*ily 11
python.org Python是用早期的gcc构建的.尝试使用gcc-4.0而不是SL的默认值4.2:
export CC=/usr/bin/gcc-4.0
Run Code Online (Sandbox Code Playgroud)
看到类似的问题在这里.
这超越了stdarg问题.然后,您可能会遇到各种依赖库的后续构建问题.
SLW,gcc-4.0和gcc-4.2都包含在Snow Leopard的Xcode 3中,因此无需额外安装.
修订2011-05:请注意,较新的Xcode 4,发布实验使用10.6及预期10.7标准,不再包括PPC支持,所以,如果你安装的Xcode 4,这个建议是行不通的.选项包括使用python.org中较新的64位/ 32-bin Python 2.7.x安装程序或使用MacPorts,Homebrew或Fink安装较新的Python 2.6和PIL以及各种第三方库.
以下是我在Mac OS X 10.6上成功安装PIL的步骤(不使用MacPorts或Fink).
安装readline
cd ~/src
curl -O ftp://ftp.cwru.edu/pub/bash/readline-6.0.tar.gz
tar -xvzf readline-6.0.tar.gz
cd readline-6.0
./configure
make
sudo make install
Run Code Online (Sandbox Code Playgroud)安装gbdm
cd ~/src
curl -O ftp://mirror.anl.gov/pub/gnu/gdbm/gdbm-1.8.3.tar.gz
tar -xvzf gbdm-1.8.3.tar.gz
cd gdbm-1.8.3
# Need to modify Makefile.in
perl -pi -e 's/BINOWN = bin/BINOWN = root/' Makefile.in
perl -pi -e 's/BINGRP = bin/BINGRP = wheel/' Makefile.in
./configure
make
sudo make install
Run Code Online (Sandbox Code Playgroud)从Mercurial Repo编译最新的Python 2.6.2+
cd ~/development
hg clone http://code.python.org/hg/branches/release2.6-maint/ python-release2.6-maint.hg
cd python-release2.6-main.hg
./configure --enable-framework MACOSX_DEPLOYMENT_TARGET=10.6
make
sudo make frameworkinstall
Run Code Online (Sandbox Code Playgroud)
注意:运行后我确实收到以下错误make.但是,我继续说道,因为我并不担心错过这些模块,而且我能够成功安装PIL.
Failed to find the necessary bits to build these modules:
_bsddb dl imageop
linuxaudiodev ossaudiodev spwd
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Failed to build these modules:
Nav
running build_scripts
Run Code Online (Sandbox Code Playgroud)更新.bash_profile用于新的Python 2.6.2+和virtualenvwrapper
# Set PATH for MacPython 2.6 if Python2.6 is installed
if [ -x /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 ]; then
PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
export PATH
fi
# MDR April 23, 2009: Added for virtualenvwrapper
if [ -x /Library/Frameworks/Python.framework/Versions/2.6/bin/virtualenvwrapper_bashrc ]; then
export WORKON_HOME=$HOME/.virtualenvs
export PIP_VIRTUALENV_BASE=$WORKON_HOME
source /Library/Frameworks/Python.framework/Versions/2.6/bin/virtualenvwrapper_bashrc
fi
Run Code Online (Sandbox Code Playgroud)为Python 2.6.2+安装easy_install,pip,virtualenv和virtualenvwrapper
curl -O http://peak.telecommunity.com/dist/ez_setup.py
sudo python ez_setup.py
sudo easy_install pip
sudo easy_install virtualenv
sudo easy_install virtualenvwrapper
Run Code Online (Sandbox Code Playgroud)创建virtualenv,然后使用pip安装PIL
mkvirtualenv pil-test
cdvirtualenv
easy_install pip
pip install http://effbot.org/downloads/Imaging-1.1.6.tar.gz
Run Code Online (Sandbox Code Playgroud)注意:我无法使用PIL安装pip install pil,所以我从URL安装如上所示.
从我在你的pip-log.txt文件中可以看到,你看来是使用2009年4月16日发布的Python.org 的Mac安装程序磁盘映像安装了Python 2.6.2 .你能证实这一点吗?
从pip日志中,gcc以退出状态1失败.gcc来自pip日志的违规命令如下:
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/local/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.3-fat-2.6/_imaging.o
Run Code Online (Sandbox Code Playgroud)
这似乎是改变用于-arch标志的默认值有关雪豹一个问题从i386到x86-64根据罗纳德Oussoren在消息92083的Python的问题6802.有一个补丁可用的Python 2.6.2,但它尚未集成到Mac安装程序磁盘映像中.
不涉及MacPorts或Fink的最佳解决方案可能是从Mercurial Python Repository或Subversion Python Repository的2.6版本分支编译和安装Python .据消息92315的问题6802,罗纳德Oussoren固定这个版本r74686.
我一直在使用从Mac Disk Image安装的Python 2.6.2看到类似的错误,同时尝试在virtualenv中安装Fabric,所以我打算从2.6版本维护分支编译和安装.如果你愿意,我会在成功时更新.