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

时间:2015-08-01 18:29:23

标签: python macos anaconda pyobjc

sudo pip install pyobjc返回:

      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

同时

easy_install -U pyobjc

python install setup.py install

返回

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个)

至少有一些人遇到过类似的问题: errorr installing pyobjc on Anaconda python on OSX 10.10.2

有人解决了吗?

1 个答案:

答案 0 :(得分:2)

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

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']