fat 文件,但缺少兼容架构有“i386,x86_64”,需要“arm64e”; Mac M1 Pro 芯片上的 bcrypt 错误

发布于 2025-01-11 22:23:03 字数 1340 浏览 4 评论 0原文

我最近从 2017 年 MBP 升级到了配备 M1 Pro 芯片的 2021 年 MBP。

从那时起,我在运行 Python 2.7 脚本时遇到了问题。

我正在使用 paramiko:

#!/usr/bin/env python

...
import paramiko
...

...当我运行脚本时,出现以下错误:

Traceback (most recent call last):
  File "/Users/crmpicco/deploy.py", line 14, in <module>
    import paramiko
  File "/Library/Python/2.7/site-packages/paramiko/__init__.py", line 22, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 90, in <module>
    from paramiko.ed25519key import Ed25519Key
  File "/Library/Python/2.7/site-packages/paramiko/ed25519key.py", line 17, in <module>
    import bcrypt
  File "/Library/Python/2.7/site-packages/bcrypt/__init__.py", line 25, in <module>
    from bcrypt import _bcrypt
ImportError: dlopen(/Library/Python/2.7/site-packages/bcrypt/_bcrypt.so, 0x0002): tried: '/Library/Python/2.7/site-packages/bcrypt/_bcrypt.so' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/_bcrypt.so' (no such file)

该文件绝对正如错误所述,存在,但我不确定如何继续。

locate bcrypt.so
/Library/Python/2.7/site-packages/bcrypt/_bcrypt.so

I have recently upgraded from a 2017 MBP to a 2021 MBP with the M1 Pro chip.

Since then i've had issue running a Python 2.7 script.

I am using paramiko:

#!/usr/bin/env python

...
import paramiko
...

...and when I run the script I get the following error:

Traceback (most recent call last):
  File "/Users/crmpicco/deploy.py", line 14, in <module>
    import paramiko
  File "/Library/Python/2.7/site-packages/paramiko/__init__.py", line 22, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 90, in <module>
    from paramiko.ed25519key import Ed25519Key
  File "/Library/Python/2.7/site-packages/paramiko/ed25519key.py", line 17, in <module>
    import bcrypt
  File "/Library/Python/2.7/site-packages/bcrypt/__init__.py", line 25, in <module>
    from bcrypt import _bcrypt
ImportError: dlopen(/Library/Python/2.7/site-packages/bcrypt/_bcrypt.so, 0x0002): tried: '/Library/Python/2.7/site-packages/bcrypt/_bcrypt.so' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/_bcrypt.so' (no such file)

The file definitely exists, as the error says, but i'm unsure how to proceed.

locate bcrypt.so
/Library/Python/2.7/site-packages/bcrypt/_bcrypt.so

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

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

发布评论

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

评论(1

夜唯美灬不弃 2025-01-18 22:23:03

我能找到的唯一解决方案是卸载并重新安装一堆 Python 包,名称为 bcrypt、cffi、PyNaCl 和密码学。

sudo python2.7 -m pip uninstall bcrypt 
python2.7 -m pip install bcrypt --user

sudo python2.7 -m pip uninstall cffi
python2.7 -m pip install cffi --user

sudo python2.7 -m pip uninstall PyNaCl
python2.7 -m pip install PyNaCl==1.4.0 --user

sudo -H python2.7 -m pip uninstall cryptography
python2.7 -m pip install cryptography --user

The only solution I could find for this was an uninstall and re-install of a bunch of Python packages, name bcrypt, cffi, PyNaCl and cryptography.

sudo python2.7 -m pip uninstall bcrypt 
python2.7 -m pip install bcrypt --user

sudo python2.7 -m pip uninstall cffi
python2.7 -m pip install cffi --user

sudo python2.7 -m pip uninstall PyNaCl
python2.7 -m pip install PyNaCl==1.4.0 --user

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