`import objc` 中的错误:找不到符号:_PyType_Modified

发布于 2024-09-09 23:06:45 字数 6735 浏览 10 评论 0 原文

我的系统是 Mac OS X 10.5.8,我已经从 http://www.python.org/ftp/python/2.5.4/python-2.5.4-macosx.dmg 因为我不想使用系统 python (python 已经自带了与 Mac OS X 一起安装)并完全删除了系统 python。

现在,当我尝试安装 pyobjc 时,它会安装,但在导入时会出现错误

Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) 
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyobjc_core-2.2-py2.5-macosx-10.3-i386.egg/objc/__init__.py", line 22, in <module>
    _update()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyobjc_core-2.2-py2.5-macosx-10.3-i386.egg/objc/__init__.py", line 19, in _update
    import _objc
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyobjc_core-2.2-py2.5-macosx-10.3-i386.egg/objc/_objc.so, 2): 
Symbol not found: _PyType_Modified
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyobjc_core-2.2-py2.5-macosx-10.3-i386.egg/objc/_objc.so
  Expected in: dynamic lookup

有人用 python.org python 安装了 pyobjc 吗?

如果有帮助,这里是执行“easy_install pyobjc”时的警告

Running pyobjc-core-2.2/setup.py -q bdist_egg --dist-dir /var/folders/tW/tWnuazCRFjexteMIweC5H++++TI/-Tmp-/easy_install-jttwg4/pyobjc-core-2.2/egg-dist-tmp-vuhvjT
warning: no directories found matching 'Scripts'
warning: no directories found matching 'setup-lib'
warning: no directories found matching 'source-deps'
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
libffi-src/powerpc/ppc-ffi_darwin.c:95: warning: no previous prototype for 'ffi_prep_args'
libffi-src/powerpc/ppc-ffi_darwin.c:819: warning: no previous prototype for 'ffi_closure_helper_DARWIN'
libffi-src/powerpc/ppc-ffi_darwin.c: In function 'ffi_closure_helper_DARWIN':
libffi-src/powerpc/ppc-ffi_darwin.c:854: warning: comparison between signed and unsigned
libffi-src/powerpc/ppc-ffi_darwin.c:910: warning: pointer of type 'void *' used in arithmetic
libffi-src/powerpc/ppc-ffi_darwin.c:910: warning: pointer of type 'void *' used in arithmetic
libffi-src/x86/x86-ffi_darwin.c:39: warning: no previous prototype for 'ffi_prep_args'
libffi-src/x86/x86-ffi_darwin.c:178: warning: function declaration isn't a prototype
libffi-src/x86/x86-ffi_darwin.c:186: warning: function declaration isn't a prototype
Modules/objc/objc-class.m: In function 'PyObjCClass_New':
Modules/objc/objc-class.m:1416: warning: implicit declaration of function 'PyType_Modified'
Modules/objc/objc-class.m:1416: warning: nested extern declaration of 'PyType_Modified'
Modules/objc/objc-class.m: In function 'PyObjCClass_New':
Modules/objc/objc-class.m:1416: warning: implicit declaration of function 'PyType_Modified'
Modules/objc/objc-class.m:1416: warning: nested extern declaration of 'PyType_Modified
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForKeyedArchiver:]':
Modules/objc/OC_PythonObject.m:1370: warning: conflicting types for '-(NSObject *)replacementObjectForKeyedArchiver:(NSKeyedArchiver *)archiver'
Modules/objc/OC_PythonObject.h:102: warning: previous declaration of '-(NSObject *)replacementObjectForKeyedArchiver:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForCoder:]':
Modules/objc/OC_PythonObject.m:1376: warning: conflicting types for '-(NSObject *)replacementObjectForCoder:(NSCoder *)archiver'
Modules/objc/OC_PythonObject.h:103: warning: previous declaration of '-(NSObject *)replacementObjectForCoder:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForPortCoder:]':
Modules/objc/OC_PythonObject.m:1382: warning: conflicting types for '-(NSObject *)replacementObjectForPortCoder:(NSPortCoder *)archiver'
Modules/objc/OC_PythonObject.h:104: warning: previous declaration of '-(NSObject *)replacementObjectForPortCoder:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForKeyedArchiver:]':
Modules/objc/OC_PythonObject.m:1370: warning: conflicting types for '-(NSObject *)replacementObjectForKeyedArchiver:(NSKeyedArchiver *)archiver'
Modules/objc/OC_PythonObject.h:102: warning: previous declaration of '-(NSObject *)replacementObjectForKeyedArchiver:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForCoder:]':
Modules/objc/OC_PythonObject.m:1376: warning: conflicting types for '-(NSObject *)replacementObjectForCoder:(NSCoder *)archiver'
Modules/objc/OC_PythonObject.h:103: warning: previous declaration of '-(NSObject *)replacementObjectForCoder:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForPortCoder:]':
Modules/objc/OC_PythonObject.m:1382: warning: conflicting types for '-(NSObject *)replacementObjectForPortCoder:(NSPortCoder *)archiver'
Modules/objc/OC_PythonObject.h:104: warning: previous declaration of '-(NSObject *)replacementObjectForPortCoder:(NSObject *)archiver'
Modules/objc/test/protocol.m:19: warning: incomplete implementation of class 'OC_TestProtocolClass'
Modules/objc/test/protocol.m:19: warning: method definition for '-method2:' not found
Modules/objc/test/protocol.m:19: warning: method definition for '-method1' not found
Modules/objc/test/protocol.m:19: warning: class 'OC_TestProtocolClass' does not fully implement the 'OC_TestProtocol' protocol
Modules/objc/test/protocol.m:19: warning: incomplete implementation of class 'OC_TestProtocolClass'
Modules/objc/test/protocol.m:19: warning: method definition for '-method2:' not found
Modules/objc/test/protocol.m:19: warning: method definition for '-method1' not found
Modules/objc/test/protocol.m:19: warning: class 'OC_TestProtocolClass' does not fully implement the 'OC_TestProtocol' protocol
Modules/objc/test/testclassandinst.m: In function '+[PyObjC_TestUnallocatable allocWithZone:]':Modules/objc/test/testclassandinst.m: In function '+[PyObjC_TestUnallocatable allocWithZone:]':
Modules/objc/test/testclassandinst.m:22: warning: unused parameter 'zone'
Modules/objc/test/testclassandinst.m:22: warning: unused parameter 'zone'

My system is Mac OS X 10.5.8 and I have installed python from http://www.python.org/ftp/python/2.5.4/python-2.5.4-macosx.dmg because I do not want to use System python (python which already comes installed with Mac OS X) and have totally removed system python.

Now when I try to install pyobjc it installs, but on import gives error

Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) 
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyobjc_core-2.2-py2.5-macosx-10.3-i386.egg/objc/__init__.py", line 22, in <module>
    _update()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyobjc_core-2.2-py2.5-macosx-10.3-i386.egg/objc/__init__.py", line 19, in _update
    import _objc
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyobjc_core-2.2-py2.5-macosx-10.3-i386.egg/objc/_objc.so, 2): 
Symbol not found: _PyType_Modified
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyobjc_core-2.2-py2.5-macosx-10.3-i386.egg/objc/_objc.so
  Expected in: dynamic lookup

Has anybody installed pyobjc with python.org python?

If it is of help, here are the warnings while doing "easy_install pyobjc"

Running pyobjc-core-2.2/setup.py -q bdist_egg --dist-dir /var/folders/tW/tWnuazCRFjexteMIweC5H++++TI/-Tmp-/easy_install-jttwg4/pyobjc-core-2.2/egg-dist-tmp-vuhvjT
warning: no directories found matching 'Scripts'
warning: no directories found matching 'setup-lib'
warning: no directories found matching 'source-deps'
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
libffi-src/powerpc/ppc-ffi_darwin.c:95: warning: no previous prototype for 'ffi_prep_args'
libffi-src/powerpc/ppc-ffi_darwin.c:819: warning: no previous prototype for 'ffi_closure_helper_DARWIN'
libffi-src/powerpc/ppc-ffi_darwin.c: In function 'ffi_closure_helper_DARWIN':
libffi-src/powerpc/ppc-ffi_darwin.c:854: warning: comparison between signed and unsigned
libffi-src/powerpc/ppc-ffi_darwin.c:910: warning: pointer of type 'void *' used in arithmetic
libffi-src/powerpc/ppc-ffi_darwin.c:910: warning: pointer of type 'void *' used in arithmetic
libffi-src/x86/x86-ffi_darwin.c:39: warning: no previous prototype for 'ffi_prep_args'
libffi-src/x86/x86-ffi_darwin.c:178: warning: function declaration isn't a prototype
libffi-src/x86/x86-ffi_darwin.c:186: warning: function declaration isn't a prototype
Modules/objc/objc-class.m: In function 'PyObjCClass_New':
Modules/objc/objc-class.m:1416: warning: implicit declaration of function 'PyType_Modified'
Modules/objc/objc-class.m:1416: warning: nested extern declaration of 'PyType_Modified'
Modules/objc/objc-class.m: In function 'PyObjCClass_New':
Modules/objc/objc-class.m:1416: warning: implicit declaration of function 'PyType_Modified'
Modules/objc/objc-class.m:1416: warning: nested extern declaration of 'PyType_Modified
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForKeyedArchiver:]':
Modules/objc/OC_PythonObject.m:1370: warning: conflicting types for '-(NSObject *)replacementObjectForKeyedArchiver:(NSKeyedArchiver *)archiver'
Modules/objc/OC_PythonObject.h:102: warning: previous declaration of '-(NSObject *)replacementObjectForKeyedArchiver:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForCoder:]':
Modules/objc/OC_PythonObject.m:1376: warning: conflicting types for '-(NSObject *)replacementObjectForCoder:(NSCoder *)archiver'
Modules/objc/OC_PythonObject.h:103: warning: previous declaration of '-(NSObject *)replacementObjectForCoder:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForPortCoder:]':
Modules/objc/OC_PythonObject.m:1382: warning: conflicting types for '-(NSObject *)replacementObjectForPortCoder:(NSPortCoder *)archiver'
Modules/objc/OC_PythonObject.h:104: warning: previous declaration of '-(NSObject *)replacementObjectForPortCoder:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForKeyedArchiver:]':
Modules/objc/OC_PythonObject.m:1370: warning: conflicting types for '-(NSObject *)replacementObjectForKeyedArchiver:(NSKeyedArchiver *)archiver'
Modules/objc/OC_PythonObject.h:102: warning: previous declaration of '-(NSObject *)replacementObjectForKeyedArchiver:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForCoder:]':
Modules/objc/OC_PythonObject.m:1376: warning: conflicting types for '-(NSObject *)replacementObjectForCoder:(NSCoder *)archiver'
Modules/objc/OC_PythonObject.h:103: warning: previous declaration of '-(NSObject *)replacementObjectForCoder:(NSObject *)archiver'
Modules/objc/OC_PythonObject.m: In function '-[OC_PythonObject replacementObjectForPortCoder:]':
Modules/objc/OC_PythonObject.m:1382: warning: conflicting types for '-(NSObject *)replacementObjectForPortCoder:(NSPortCoder *)archiver'
Modules/objc/OC_PythonObject.h:104: warning: previous declaration of '-(NSObject *)replacementObjectForPortCoder:(NSObject *)archiver'
Modules/objc/test/protocol.m:19: warning: incomplete implementation of class 'OC_TestProtocolClass'
Modules/objc/test/protocol.m:19: warning: method definition for '-method2:' not found
Modules/objc/test/protocol.m:19: warning: method definition for '-method1' not found
Modules/objc/test/protocol.m:19: warning: class 'OC_TestProtocolClass' does not fully implement the 'OC_TestProtocol' protocol
Modules/objc/test/protocol.m:19: warning: incomplete implementation of class 'OC_TestProtocolClass'
Modules/objc/test/protocol.m:19: warning: method definition for '-method2:' not found
Modules/objc/test/protocol.m:19: warning: method definition for '-method1' not found
Modules/objc/test/protocol.m:19: warning: class 'OC_TestProtocolClass' does not fully implement the 'OC_TestProtocol' protocol
Modules/objc/test/testclassandinst.m: In function '+[PyObjC_TestUnallocatable allocWithZone:]':Modules/objc/test/testclassandinst.m: In function '+[PyObjC_TestUnallocatable allocWithZone:]':
Modules/objc/test/testclassandinst.m:22: warning: unused parameter 'zone'
Modules/objc/test/testclassandinst.m:22: warning: unused parameter 'zone'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文