Mac osx lion、virtualenv、pil 安装 - gcc 错误
我刚刚完成xcode安装,mac osx lion。完成后,我尝试使用 pip、easy_install 和 homebrew 在虚拟环境中安装 PIL。这三个人都犯了错误。 pip install 出现以下错误:
pip `
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
`
easy_install 无法执行 gcc-4.0:没有这样的文件或目录 错误:安装脚本退出并出现错误:命令'gcc-4.0'失败,退出状态1
homebrew 错误:执行失败:python setup.py build_ext
我不太确定该去哪里从这里。
谢谢, CG
I have just completed the xcode install, mac osx lion. Upon completion I attempted to install PIL in a virtual enviroment using pip, easy_install and home brew. All three are erring out. pip install give the following error:
pip `
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
`
easy_install unable to execute gcc-4.0: No such file or directory
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1
home brew Error: Failed executing: python setup.py build_ext
I am not really sure where to go from here.
Thanks,
CG
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
OS X Lion 10.7 上的 Xcode 4.1 不再像早期版本的 OS X 中那样包含
gcc-4.0
。当您安装包含 C 扩展模块的 Python 包(例如 PIL)时,Python 的 Distutils 将尝试使用与 Python 本身构建时相同版本的 C 编译器。听起来用于创建virtualenv
的 Python 版本是使用gcc-4.0
构建的旧版 32 位 Python。您可以通过在virtualenv
中启动python
来确定。如果显示gcc-4.0
,您将需要使用较新的基础 Python(Lion 中 Apple 提供的 Python 之一)或使用 python.org 安装较新的 Python 来重新创建 virtualenv安装程序或酿造配方。然后为该Python安装Distribute
和pip
和virtualenv
,创建一个新的virutalenv,然后在其中安装PIL。Xcode 4.1 on OS X Lion 10.7 no longer includes
gcc-4.0
as it did in earlier versions of OS X. When you install a Python package like PIL that includes a C extension module, Python's Distutils will attempt to use the same version of the C compiler that that Python itself was build with. It sounds like the version of Python that was used to create yourvirtualenv
is an older 32-bit-only Python built withgcc-4.0
. You can tell for sure by starting thepython
in yourvirtualenv
. If it saysgcc-4.0
, you will need to re-create the virtualenv, using a newer base Python, either one of the Apple-supplied Pythons in Lion or installing a newer python using a python.org installer or a brew recipe. Then installDistribute
andpip
andvirtualenv
for that Python, create a new virutalenv and then install PIL in it.在花了几个小时解决同样的问题后,这对我有用:
下载 PIL 源代码并将其放入其中。
检查您拥有哪个版本的
gcc
:然后我强制应用此版本:
并选择正确的体系结构(在我的例子中为 32 位):
对于 64,请使用导出
ARCHFLAGS="-arch x86_64"
然后构建并安装:
After spending hours on the same problem this is what it worked for me:
Download the PIL source code and cd into it.
Check which version of
gcc
do you have by:Then I force to apply this version by:
And select the correct architecture (in my case 32bit):
For 64 use export
ARCHFLAGS="-arch x86_64"
Then build and install:
您能在系统上找到
gcc-4.0
二进制文件吗?您可能需要将其所在的目录添加到您的PATH
环境变量中。Can you find the
gcc-4.0
binary on your system? You might need to add the directory it's in to yourPATH
environment variable.如果有帮助的话,我用符号链接解决了这个讨厌的问题,我认为它会对你有用。我写这篇文章时考虑的是我的 gcc 版本,即 4.2:
好了!
If it helps any, I solved this pesky issue with sym links, and I think it will work for you. I wrote this with my version of gcc in mind, which is 4.2:
There ya go!
一个想法是将 gcc-4.0 指向默认的 gcc 标志:
An Idea would be to point gcc-4.0 to the default gcc flag: