【问题标题】:pyobjc installation failure: xcode-select: error: tool 'xcodebuild' requires Xcodepyobjc安装失败:xcode-select:错误:工具'xcodebuild'需要Xcode
【发布时间】:2015-09-12 16:27:38
【问题描述】:

我需要pyobcj 才能让pyttsx 工作。当我尝试使用 pip 安装 pyobjc 时,我得到以下信息:

My-MacBook-Pro:WebForm $MyName$ sudo pip install pyobjc
The directory '/Users/$MyName/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
You are using pip version 7.0.1, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The directory '/Users/$MyName/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pyobjc
  Downloading pyobjc-3.0.4.tar.gz
Collecting py2app>=0.8 (from pyobjc)
  Downloading py2app-0.9.tar.gz (1.7MB)
    100% |████████████████████████████████| 1.7MB 137kB/s 
Collecting pyobjc-core==3.0.4 (from pyobjc)
  Downloading pyobjc-core-3.0.4.tar.gz (2.2MB)
    100% |████████████████████████████████| 2.2MB 103kB/s 
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/pyobjc_core.egg-info
    writing include/pyobjc-compat.h to pip-egg-info/pyobjc_core.egg-info/include/pyobjc-compat.h
    writing include/pyobjc-api.h to pip-egg-info/pyobjc_core.egg-info/include/pyobjc-api.h
    writing pip-egg-info/pyobjc_core.egg-info/PKG-INFO
    writing namespace_packages to pip-egg-info/pyobjc_core.egg-info/namespace_packages.txt
    writing top-level names to pip-egg-info/pyobjc_core.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/pyobjc_core.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/pyobjc_core.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/private/tmp/pip-build-4NP01v/pyobjc-core/setup.py", line 619, in <module>
        **parse_package_metadata()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/private/tmp/pip-build-4NP01v/pyobjc-core/setup.py", line 331, in run
        egg_info.egg_info.run(self)
      File "<string>", line 15, in replacement_run
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 207, in find_sources
        mm.run()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 291, in run
        self.add_defaults()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 320, in add_defaults
        sdist.add_defaults(self)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/sdist.py", line 130, in add_defaults
        build_ext = self.get_finalized_command('build_ext')
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/private/tmp/pip-build-4NP01v/pyobjc-core/setup.py", line 471, in finalize_options
        universal_newlines=True).strip()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '['/usr/bin/xcodebuild', '-version', '-sdk', 'macosx', 'Path']' returned non-zero exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-4NP01v/pyobjc-core

我已经尝试使用建议的 -H 标志,但没有成功。我在这里错过了什么?

  • Python:2.7.10
  • 操作系统:X,优胜美地

【问题讨论】:

  • 你有命令行工具吗?

标签: python xcode python-2.7 pip pyobjc


【解决方案1】:

XCode 是requirement,所以install 它和命令行工具通过您首选的shell:

xcode-select --install

【讨论】:

  • 我得到了同样的错误。我已经安装了命令行工具,xcode-select --insallyields xcode-select: error: command line tools are already installed, use "Software Update" to install updates。我真的需要完整的 XCode 安装吗?
  • 验证您是否已成功安装 Xcode 命令行工具 xcode-select -p 和编译器 gcc --version
  • 是的,这行得通。我只有命令行工具但没有完整的 Xcode 安装,这似乎是一个问题(因为 El Capitan 左右):stackoverflow.com/a/20671590/2148890
猜你喜欢
  • 1970-01-01
  • 2012-01-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多