python-mach-o文件,但它是一个不兼容的体系结构(have';arm64';,need';x86#u 64';)
发布时间:2022-02-25 09:30:43 344
相关标签:
我想在Python程序中使用C++函数,所以我用命令编译动态库文件:
cc -fPIC -shared -o encrypt_for_python.so encrypt_for_python.cpp -L/opt/homebrew/Cellar/openssl@1.1/1.1.1l/lib -I/opt/homebrew/Cellar/openssl@1.1/1.1.1l/include -lssl -lcrypto -std=c++11
但当我在python文件中使用它时,我得到了一个错误:
Traceback (most recent call last):
File "/Users/debris/Documents/Job/HA/encryption-cpp/test_encrypt.py", line 6, in
my_func = CDLL(so_file)
File "/Users/debris/miniconda3/lib/python3.9/ctypes/__init__.py", line 382, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/debris/Documents/Job/HA/encryption-cpp/encrypt_for_python.so, 0x0006): tried: '/Users/debris/Documents/Job/HA/encryption-cpp/encrypt_for_python.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/encrypt_for_python.so' (no such file), '/usr/lib/encrypt_for_python.so' (no such file)
我发现mach-o文件,但它是一个不兼容的体系结构(有“arm64”,需要“x86_64”),我该怎么修?
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报