我遇到了在PyCharm中导入Fitz库的问题。我安装了PyMuPDF,并在我的代码中添加了“import fitz”,但它给了我这个错误:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fitz/_fitz.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fitz/_fitz.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fitz/_fitz.so' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/fitz/_fitz.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
如何修复此错误?
2条答案
按热度按时间6ss1mwsb1#
您似乎正在使用M1-MacBook,因此出现此错误
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
。直接为“x86_64”架构执行pip install PyMuPDF
构建。您需要通过以下方式直接从源版本构建PyMuPDF
:mupdf
、swig
和freetype
你可以从这里了解更多:
xesrikrc2#
问题是这个不能在我的mac mini m2芯片上工作,因为没有任何轮子支持它,但有一个新的轮子。如果你有同样的问题,在你的终端上使用这个。