我使用 PythonKit 和 XCode 从 swift 代码调用 spaCy API。从 Home-brew 安装了 PythonKit,将其导入到我的项目中并且构建得很好;但是,在运行时我收到错误:
Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library.
Run Code Online (Sandbox Code Playgroud)
所以我编译了PythonTools(在PythonKit目录中,运行swift package generate-xcodeproj并打开PythonKit.xcodeproj文件)来查看它会找到Python库的哪些路径:
/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python37.zip
/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7
/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload
/Users/fernandabrum/Library/Python/3.7/lib/python/site-packages
/usr/local/lib/python3.7/site-packages
Run Code Online (Sandbox Code Playgroud)
如果我的系统中存在 Python 库,为什么会出现“未找到 Python 库”的错误?我究竟做错了什么?
OBS.:我还尝试设置 PYTHON_LIBRARYexport PYTHON_LIBRARY=和上面找到的路径,但不成功。
提前致谢!
我有一个8位数的BCD号码,需要查看它是否是有效的BCD号码.我怎样才能以编程方式(C/C++)制作这个?
例如:0x12345678有效,但0x00f00abc不是.
提前致谢!