I'm using PythonKit with XCode to call spaCy API from swift code. Installed PythonKit from Home-brew, imported it in my project and it built well; however, at runtime I got the error:
Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library.
So I compiled PythonTools (within PythonKit dir, run swift package generate-xcodeproj
and open PythonKit.xcodeproj file ) to see which paths of Python library it would find:
/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
If Python libraries are in my system, why I get an error of Python library not found? What am I doing wrong?
OBS.:
I also tried to set PYTHON_LIBRARY with export PYTHON_LIBRARY=
and the paths found above, but unsuccessful.
Thanks in advance!
PythonLibrary.useVersion(3)
andPythonLibrary.useLibrary(at: "/usr/bin/python3.8")
, as well as the linuxbrew install, but nothing other than the/usr/bin/python
(2.17) version works. – Zygotene