MacOS 12.x Python / c++应用程序并从M1机器强迫X86

发布于 2025-01-18 06:15:43 字数 557 浏览 1 评论 0原文

我正在更新我的 MacOS python/c++ 应用程序,该应用程序在我的旧 x86 机器上运行良好,现在必须在我的新 M1 以及旧 x86 机器上构建和运行。目前无法更新一个二进制库,因此我希望可以通过 Rosetta 在 x86 中透明地运行整个库。在 C++ 构建中的某个地方,我一定很高兴按照预期制作 x86 兼容库,但是当我使用默认的 MacOS Python 实例运行 python 代码时,在加载 C++ 库时出现以下错误:

(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))

如何解决该问题?我认为我应该能够获取 Python 的 x86 实例,创建 venv,然后使用 vent 运行。也许我应该在此处获取它,然后解决如何调用新版本而不是MacOS默认,直到我得到一个新的 venv 并针对它运行。

如何以最合适的方式解决此错误?

I am updating my MacOS python/c++ application that ran fine on my older x86 machine now must build and run on my new M1 as well as older x86 machines. One binary library cannot be updated at this time so my hope is that I can run the whole thing transparently in x86 through Rosetta. Somewhere in the c++ builds, I must be happily making x86 compatible libraries, as intended, but when I run the python code using the default MacOS Python instance, I get the following error when loading the c++ library:

(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))

How do I resolve the issue? I THINK I should able to acquire an x86 instance of Python, create a venv, and then run using the vent. Maybe I should get it here and then resolve how to call the new version instead of the MacOS default until I get a new venv and run against that.

How do I resolve this error in the most appropriate way?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文