#2075 OSError: cannot load library '/usr/local/lib/libsndfile.dylib': dlopen(/usr/local/lib/libsndfile.dylib, 0x0002): tried:

91.196* Posted at: 8 hours ago 👁8

Traceback (most recent call last):
File "/Users/justinfungcheuk/pyvideotrans/.venv/lib/python3.10/site-packages/soundfile.py", line 267, in

_snd = _ffi.dlopen('sndfile')

File "/Users/justinfungcheuk/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 150, in dlopen

lib, function_cache = _make_ffi_library(self, name, flags)

File "/Users/justinfungcheuk/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 834, in _make_ffi_library

backendlib = _load_backend_lib(backend, libname, flags)

File "/Users/justinfungcheuk/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 830, in _load_backend_lib

return backend.load_library(path, flags)

OSError: cannot load library '/usr/local/lib/libsndfile.dylib': dlopen(/usr/local/lib/libsndfile.dylib, 0x0002): tried: '/usr/local/lib/libsndfile.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libsndfile.dylib' (no such file), '/usr/local/lib/libsndfile.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/usr/local/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib' (no such file), '/usr/local/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/justinfungcheuk/pyvideotrans/videotrans/mainwin/_main_win.py", line 75, in _set_Ui_Text

from videotrans import VERSION, recognition, tts

File "/Users/justinfungcheuk/pyvideotrans/videotrans/tts/__init__.py", line 26, in

from videotrans.tts._vits import VitsCNEN

File "/Users/justinfungcheuk/pyvideotrans/videotrans/tts/_vits.py", line 16, in

import soundfile as sf

File "/Users/justinfungcheuk/pyvideotrans/.venv/lib/python3.10/site-packages/soundfile.py", line 276, in

_snd = _ffi.dlopen(_os.path.join(

File "/Users/justinfungcheuk/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 150, in dlopen

lib, function_cache = _make_ffi_library(self, name, flags)

File "/Users/justinfungcheuk/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 834, in _make_ffi_library

backendlib = _load_backend_lib(backend, libname, flags)

File "/Users/justinfungcheuk/pyvideotrans/.venv/lib/python3.10/site-packages/cffi/api.py", line 830, in _load_backend_lib

return backend.load_library(path, flags)

OSError: cannot load library '/usr/local/lib/libsndfile.dylib': dlopen(/usr/local/lib/libsndfile.dylib, 0x0002): tried: '/usr/local/lib/libsndfile.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libsndfile.dylib' (no such file), '/usr/local/lib/libsndfile.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/usr/local/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib' (no such file), '/usr/local/Cellar/libsndfile/1.2.2_1/lib/libsndfile.1.0.37.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))


=
system:macOS-14.6.1-arm64-i386-64bit
version:v3.90
frozen:False
language:zh
root_dir:/Users/justinfungcheuk/pyvideotrans
Python: 3.10.19 (main, Dec 9 2025, 19:17:38) [Clang 21.1.4 ]

1 Replies

此错误表明您的 Mac (arm64 架构) 上安装的 libsndfile 库是 x86_64 架构版本,与您的系统不兼容。根据知识库,Mac 用户需要正确安装此依赖。

请按以下步骤解决:

  1. 确认 Homebrew 已为 ARM 架构:打开终端,运行 which brew。如果路径是 /opt/homebrew/bin/brew,说明是 ARM 版。如果是 /usr/local/bin/brew,则是旧版 Intel 版,建议先卸载后按官网指引重装 ARM 版 Homebrew。
  2. 重新安装 libsndfile

    • 在终端中运行以下命令,强制重新安装适用于 ARM 的版本:

      brew reinstall --force libsndfile
    • 如果上述命令无效,可以先卸载再安装:

      brew uninstall libsndfile
      brew install libsndfile
  3. 验证安装:安装后,运行以下命令检查库文件架构:

    file /opt/homebrew/lib/libsndfile.dylib

    输出应包含 arm64 字样,而不是 x86_64

  4. 重启软件:完成上述操作后,重新启动 pyVideoTrans。

如果问题依旧,请尝试在终端中进入您的项目目录,使用 uv run sp.py 命令启动,并观察是否有其他错误信息。

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Donate: https://ko-fi.com/jianchang512

Trending Questions