【问题标题】:osx python setup.py will not install xattr-0.6.1 applicationosx python setup.py 不会安装 xattr-0.6.1 应用程序
【发布时间】:2012-05-09 22:47:04
【问题描述】:

我是 svn 和 python 的新手,但我真的想使用更新版本的 xattr,它包含比操作系统附带的原始版本更多有用的功能。

在 OSX 10.5.6 上,我无法安装 xattr-0.6.1。

从终端的本地机器:

$ svn co http://svn.red-bean.com/bob/xattr/releases/xattr-0.6.1/

文件被下载并放置在~/xattr-0.6.1/

$ cd xattr-0.6.1/
$ sudo python setup.py install

---------------------------------------------------------------------------
This script requires setuptools version 0.6c11 to run (even to display
help).  I will attempt to download it for you (from
http://pypi.python.org/packages/2.5/s/setuptools/), but
you may need to enable firewall access for this script first.
I will start the download in 15 seconds.

(Note: if this machine does not have network access, please obtain the file

   http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg

and place it in this directory before rerunning this script.)
---------------------------------------------------------------------------
Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg
running install
running bdist_egg
running egg_info
creating xattr.egg-info
writing xattr.egg-info/PKG-INFO
writing top-level names to xattr.egg-info/top_level.txt
writing dependency_links to xattr.egg-info/dependency_links.txt
writing entry points to xattr.egg-info/entry_points.txt
writing manifest file 'xattr.egg-info/SOURCES.txt'
writing manifest file 'xattr.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.5-i386/egg
running install_lib
running build_py
creating build
creating build/lib.macosx-10.5-i386-2.5
creating build/lib.macosx-10.5-i386-2.5/xattr
copying xattr/__init__.py -> build/lib.macosx-10.5-i386-2.5/xattr
copying xattr/constants.py -> build/lib.macosx-10.5-i386-2.5/xattr
copying xattr/tool.py -> build/lib.macosx-10.5-i386-2.5/xattr
running build_ext
building 'xattr._xattr' extension
creating build/temp.macosx-10.5-i386-2.5
creating build/temp.macosx-10.5-i386-2.5/xattr
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c xattr/_xattr.c -o build/temp.macosx-10.5-i386-2.5/xattr/_xattr.o
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1

查看python版本:

$ python -V
Python 2.5.1

它似乎已经安装了 python 更新。

我尝试再次运行 xattr 安装:

$ sudo python setup.py install
running install
running bdist_egg
running egg_info
writing xattr.egg-info/PKG-INFO
writing top-level names to xattr.egg-info/top_level.txt
writing dependency_links to xattr.egg-info/dependency_links.txt
writing entry points to xattr.egg-info/entry_points.txt
writing manifest file 'xattr.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.5-i386/egg
running install_lib
running build_py
running build_ext
building 'xattr._xattr' extension
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c xattr/_xattr.c -o build/temp.macosx-10.5-i386-2.5/xattr/_xattr.o
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1

我是否遗漏了一个重要的基本元素,或者 setup.py 配置有什么问题,或者我可能忽略了其他什么?

【问题讨论】:

    标签: python macos svn installation


    【解决方案1】:

    需要编译一个C文件,所以需要gcc。 Mac 用户需要安装XCode更新正如@jathanism 所提到的,您应该有一张随 Mac 一起提供的 XCode 安装 DVD(很可能是 3.2 版)。

    例如:

    atlas% which gcc
    /usr/bin/gcc
    atlas% gcc -v
    Target: i686-apple-darwin10
    ..
    Thread model: posix
    gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
    

    【讨论】:

    • 该链接指向您必须购买的 XCode 4。适合您系统版本的 XCode 版本捆绑在安装 DVD 的“可选安装”目录中。
    • 谢谢@samplebias、@jathanism 先生。结果我的 10.5 Leotard 升级磁盘有 Xcode 3.0,其中包括 gcc 4.0。安装 Xcode 后,我能够运行 setup.py 并且现在安装了 xattr 的更新版本。 :)
    • 很高兴听到您开始运行!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-14
    • 2014-01-06
    • 1970-01-01
    • 2015-03-02
    • 2019-07-01
    • 1970-01-01
    相关资源
    最近更新 更多