So I researched some more and I found PythonKit, which I found in the website, however, it throws up an error when I try to impliment it.
Fatal error: Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library.: file /Users/****/Library/Developer/Xcode/DerivedData/Y******L-fmpvatcxzxcglggfnkmiateqeipe/SourcePackages/checkouts/PythonKit/PythonKit/PythonLibrary.swift, line 40
2019-12-31 19:10:33.397840-0700 iSee[4616:1847618] Fatal error: Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library.: file /Users/*****/Library/Developer/Xcode/DerivedData/Y******L-fmpvatcxzxcglggfnkmiateqeipe/SourcePackages/checkouts/PythonKit/PythonKit/PythonLibrary.swift, line 40
I found the location of where the code asks to throw up that error.
public struct PythonLibrary {
private static let shared = PythonLibrary()
private static let pythonLegacySymbolName = "PyString_AsString"
private static var librarySymbolsLoaded = false
private let pythonLibraryHandle: UnsafeMutableRawPointer
private let isLegacyPython: Bool
private init() {
guard let pythonLibraryHandle = PythonLibrary.loadPythonLibrary() else {
fatalError("""
Python library not found. Set the \(Environment.library.key) \
environment variable with the path to a Python library.
""")
}
self.pythonLibraryHandle = pythonLibraryHandle
on line 11 it shows that.
The code was a swift package
below is the code in viewcontroller
// let os: PythonObject = Python.import("os")
// print ("os")
let sys: PythonObject = Python.import("sys")
print("sys")
sys.path.append("/usr/local/lib/python3.7/site-packages")
// sys.path.append("/Users/*****/Applications/Python 3.8")
The error throw up when it hits line 08.
Any help here? It would be amazing, again I searched, but I couldn't find a solution that would work, or I didn't understand what they were talking about?
Thanks.