我一直在尝试使用以下方法导入模块:
import pyexiv2
产生错误
Aruns-MacBook-Air:scripts arun$ python3 99-new-camera.py crop_field
Traceback (most recent call last):
File "99-new-camera.py", line 7, in <module>
import pyexiv2 # dnf install python3-exiv2 (py3exiv2)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyexiv2/__init__.py", line 60, in <module>
import libexiv2python
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/libexiv2python.cpython-37m-darwin.so, 2): Symbol not found: _PyCMethod_New
Referenced from: /usr/local/opt/boost-python3/lib/libboost_python39.dylib
Expected in: flat namespace
in /usr/local/opt/boost-python3/lib/libboost_python39.dylib
我已经安装了所有依赖项,我不明白为什么会出现这个错误。我在 macOS Big Sur 上运行 Python 3.7。这个问题有什么解决方法吗?
我相信我已经从这个 post 中找到了问题的解决方案,它建议通过添加链接器标志 -lboost-python3
进行修复。如何添加链接器标志并解决此问题?