无法在 OS X 10.6.3 Snow Leopard 上的 Python 中导入 obj - libiconv.2.dylib?

发布于 2024-08-29 03:01:40 字数 1036 浏览 9 评论 0原文

在 OS X 10.6.3 Snow Leopard 上

% python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
Traceback (most recent call last):
  File "", line 1, in 
  File "/Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/objc/__init__.py", line 22, in 
    _update()
  File "/Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/objc/__init__.py", line 19, in _update
    import _objc
ImportError: dlopen(/Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/objc/_objc.so, 2): Library not loaded: /opt/local/lib/libiconv.2.dylib
  Referenced from: /Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/objc/_objc.so
  Reason: Incompatible library version: _objc.so requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
>>> 

-- 我需要做什么?

on OS X 10.6.3 Snow Leopard

% python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
Traceback (most recent call last):
  File "", line 1, in 
  File "/Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/objc/__init__.py", line 22, in 
    _update()
  File "/Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/objc/__init__.py", line 19, in _update
    import _objc
ImportError: dlopen(/Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/objc/_objc.so, 2): Library not loaded: /opt/local/lib/libiconv.2.dylib
  Referenced from: /Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/objc/_objc.so
  Reason: Incompatible library version: _objc.so requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
>>> 

--
what do I need to do?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱给你人给你 2024-09-05 03:01:40

首先,我尝试临时将 /Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/ 移动到其他地方并尝试 import 语句再次。这将使操作系统能够默认导入操作系统附带的 objc 版本(位于 /System/Library 中)。通过使用 /System/Library 中的版本,它对我有用:

>>> import objc
>>> print objc.__file__ 
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC/objc/__init__.pyc

您也可以考虑将 /opt/local/lib/libiconv.2.dylib 移动到其他地方。它看起来已经过时了,OS X Snow Leopard 在 /usr/lib IIRC 中有自己的 libiconv.2.dylib 副本。

First I'd try to temporary move /Library/Python/2.6/site-packages/pyobjc_core-2.2-py2.6-macosx-10.6-universal.egg/ to somewhere else and try the import statement again. This will enable the OS to import the version of objc that came with the OS by default (this is in /System/Library). By using the version in /System/Library, it works for me:

>>> import objc
>>> print objc.__file__ 
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC/objc/__init__.pyc

You might also consider moving /opt/local/lib/libiconv.2.dylib to somewhere else. It looks outdated and OS X Snow Leopard has its own copy of libiconv.2.dylib in /usr/lib IIRC.

您很可能搞砸了操作系统的 Python 安装,因此您很可能需要重新安装操作系统。

You more than likely screwed with the OS's Python installation, so you'll more than likely need to reinstall your OS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文