关于python:安装pyobjc时出错:Anaconda2.1 python3.4或2.7,OSX 10.9

Error installing pyobjc: Anaconda2.1 python3.4 or 2.7, OSX 10.9

sudo pip install pyobjc返回:

1
2
3
4
5
6
      File"/Users/USER/anaconda/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/var/folders/48/0c48tlds0knggddqs9lwf5900000gn/T/pip-build-RZEwHr/pyobjc-core

两者都有

1
easy_install -U pyobjc

1
python install setup.py install

返回

1
2
3
4
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"setup.py", line 185, in <module>
    keywords=['Objective-C', 'bridge', 'Cocoa'],

......更多的输出线......
在负载中输入文件"/Users/USER/anaconda/lib/python2.7/pickle.py",第1382行
返回Unpickler(文件).load()
文件"/Users/USER/anaconda/lib/python2.7/pickle.py",第858行,载入中
dispatchkey
在load_reduce中输入文件"/Users/USER/anaconda/lib/python2.7/pickle.py",第1133行
value = func(* args)
TypeError:init()至少需要3个参数(给定1个)

至少还有一些人遇到过类似的问题:
错误在OSX 10.10.2上的Anaconda python上安装pyobjc

有人解决了吗?


OSX的最新版本附带预编译的PyObjc,如果您能够使用Mac版本的Python,您应该可以导入它:
Python

1
2
3
4
5
6
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type"help","copyright","credits" or"license" for more information.
>>> import objc
>>> objc.__path__
['/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc']