OSError: dlopen (libSystem.Dylib, 6):没有找到映像



刚刚更新了我的Mac到El Capitan 10.11。我试图运行Django 1.6与芹菜3.1,我现在得到这个错误:

Unhandled exception in thread started by <function wrapper at 0x10f861050>
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
    fn(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 101, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 310, in validate
    num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
    self._populate()
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 75, in _populate
    self.load_app(app_name, True)
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 99, in load_app
    models = import_module('%s.models' % app_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Library/Python/2.7/site-packages/debug_toolbar/models.py", line 9, in <module>
    dt_settings.patch_all()
  File "/Library/Python/2.7/site-packages/debug_toolbar/settings.py", line 215, in patch_all
    patch_root_urlconf()
  File "/Library/Python/2.7/site-packages/debug_toolbar/settings.py", line 203, in patch_root_urlconf
    reverse('djdt:render_panel')
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 503, in reverse
    app_list = resolver.app_dict[ns]
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 329, in app_dict
    self._populate()
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 267, in _populate
    for pattern in reversed(self.url_patterns):
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 365, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 360, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Users/pedrotorres/Documents/work/projects/bparts/netpecasv2/urls.py", line 10, in <module>
    url(r'', include('Common.urls')),
  File "/Library/Python/2.7/site-packages/django/conf/urls/__init__.py", line 26, in include
    urlconf_module = import_module(urlconf_module)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Users/pedrotorres/Documents/work/projects/bparts/Common/urls.py", line 3, in <module>
    from APIMobile.views import request_product_info_by_qrcode
  File "/Users/pedrotorres/Documents/work/projects/bparts/APIMobile/views.py", line 9, in <module>
    from Common.views import resizeImage, token_generator, getWatermarkImage, filterProductsByBrandModelVersionYear, 
  File "/Users/pedrotorres/Documents/work/projects/bparts/Common/views.py", line 34, in <module>
    from Common.tasks import turn_off_demo_mode_new_workshop
  File "/Users/pedrotorres/Documents/work/projects/bparts/Common/tasks.py", line 3, in <module>
    from netpecasv2.celeryapp import app
  File "/Users/pedrotorres/Documents/work/projects/bparts/netpecasv2/celeryapp.py", line 5, in <module>
    from celery import Celery
  File "/Library/Python/2.7/site-packages/celery/__init__.py", line 130, in <module>
    from celery import five
  File "/Library/Python/2.7/site-packages/celery/five.py", line 51, in <module>
    from kombu.five import monotonic
  File "/Library/Python/2.7/site-packages/kombu/five.py", line 52, in <module>
    libSystem = ctypes.CDLL('libSystem.dylib')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libSystem.dylib, 6): image not found

以前一切都很好。找不到解决办法。我看过这条线,但不工作:"OSError: dlopen (libSystem。Dylib, 6): image not found"(OS X + macports +芹菜3.1.7)

我之前没有任何DYLD_FALLBACK_LIBRARY_PATH。我试着:

export DYLD_FALLBACK_LIBRARY_PATH="/usr/lib":$DYLD_FALLBACK_LIBRARY_PATH

但是Python找不到库,尽管它位于"/usr/lib"

有人遇到过这样的问题吗?

我怀疑(但不能确认)OSX El Capitan的系统完整性保护(SIP)正在阻止访问您的/usr/lib文件夹。

这将是极端的,违背了安全特性的目的,但你可以尝试禁用SIP通过引导到OS X恢复分区,执行csrutil disable和重新引导…至少在找到其他选择/解决方案之前。

ArsTechnica在这里有一篇文章:http://arstechnica.com/apple/2015/09/os-x-10-11-el-capitan-the-ars-technica-review/9/

这里描述了一个类似的问题:http://blog.honekamp.net/blog/2015/09/07/el-cap-and-my-printer/

关于Hacker News的更多讨论在这里:https://news.ycombinator.com/item?id=10309576

pip install --upgrade billiard
pip install --upgrade celery
pip install --upgrade kombu
pip install --upgrade amqp

我卸载了"billiard,celery,kombu,amqp"这四个软件包。然后从github重新安装最新版本解决了这个

我在升级OS到OS X El Captain后也遇到了同样的问题。禁用SIP可以解决这个问题,但如果有人不愿意这样做,那么在站点包中的几个模块中更新five.py会有所帮助。(我知道这不是很好,但只要你知道你在做什么就可以了)

将下列模块中访问DLL的位置更新为具有绝对路径

line 145 of site-packages/amqp/five.py 
line 52 of site-packages/kombu/five.py 
line 42 of site-packages/billiard/five.py 
更新:

libSystem = ctypes.CDLL('libSystem.dylib') => libSystem = ctypes.CDLL('/usr/lib/libSystem.dylib')

我也遇到了同样的问题。

我做了一些快速的测试,下面是我发现的,但还不能把它固定在一个特定的原因上:

。stock python with ctypes.CDLL("libSystem.dylib")会导致image not found错误。

b。使用ctypes.CDLL("/usr/lib/libSystem.dylib")的stock python

c。virtualenv python with ctypes.CDLL("libSystem.dylib") works

重新安装python解决了我的问题。使用brew,你可以再次brew install python

如果显示需要权限写/usr/local,尝试通过sudo chown -R $(whoami):admin /usr/local修改权限,然后安装python。

我尝试从github更新到这些库的最新版本,但它没有帮助。我发现最简单的解决方案是使用virtualenv

virtualenv myenv
cd myenv
source bin/activate
pip install celery

确认它工作:

python -c "import celery"

这似乎比禁用操作系统的基本安全特性更可取,而且virtualenv有它自己的(有充分记录的)好处。

可以删除当前的芹菜版本,然后从http://pypi.python.org/pypi/celery/下载,构建并安装源代码。这对我很有帮助,我希望你也有帮助。

在我的情况下,错误是因为Homebrew没有正确地符号链接到gettext。我用

解决了这个问题
brew unlink gettext && brew link --force gettext

从如何安装h5py(需要Keras)在MacOS与M1?

以防有人像我一样先在这里结束,并希望避免禁用SIP。这似乎对我有用:

brew install hdf5@1.10  
export HDF5_DIR=/usr/local/Cellar/hdf5@1.10/1.10.7_1
pip install 'h5py==2.10.0' --force-reinstall --no-binary=h5py

1。当macOS Sur缺少必要的ODBC包时安装Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2。安装丢失的ODBC包

brew install libiodbc

最新更新