(mach-o 文件,但是是一个不兼容的架构(有'x86_64',需要'arm64')

问题描述 投票:0回答:2

我在 m1 上购买了 MacBook Air,并下载了 PyCharm 用于工作。当我尝试在 aiogram 上运行我的项目时,它不起作用。它给出了这个回溯:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 70, in <module>
    import cchardet as chardet
ModuleNotFoundError: No module named 'cchardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/danilapachev/Desktop/projects/06_07_bot_organization/bot.py", line 1, in <module>
    from aiogram import Bot, Dispatcher, executor, types
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiogram/__init__.py", line 9, in <module>
    from . import bot
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiogram/bot/__init__.py", line 1, in <module>
    from . import api
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiogram/bot/api.py", line 6, in <module>
    import aiohttp
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import (
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/client.py", line 59, in <module>
    from .client_reqrep import (
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 72, in <module>
    import charset_normalizer as chardet  # type: ignore[no-redef]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/__init__.py", line 24, in <module>
    from .api import from_bytes, from_fp, from_path, is_binary
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/api.py", line 5, in <module>
    from .cd import (
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/cd.py", line 9, in <module>
    from .md import is_suspiciously_successive_range
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.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/charset_normalizer/md.cpython-311-darwin.so' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) 

我尝试这个命令:

$ arch -arm64 brew install llvm

$ sudo gem install ffi

并尝试

pipx uninstall aiogram 

pipx install aiogram
python macos apple-m1 aiogram
2个回答
1
投票

在我的情况下,问题可以通过以下命令解决:

pip uninstall charset-normalizer
pip install charset-normalizer

感谢社区


0
投票

我遇到了同样的错误 - charset_normalizer/md.cpython-39-darwin.so, 0x0002): 尝试过: '/Library/Python/3.9/site-packages/charset_normalizer/md.cpython-39-darwin.so' ( mach-o 文件,但它是一个不兼容的体系结构(有“arm64”,需要“x86_64”))。 我已经卸载并安装了 charset_normalizer 好几次了。

如果有什么区别,我正在使用 Pycharm。

谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.