I am now using Swift Package Manager.
Using that, I imported PythonKit into my Swift project.
I can't import the Python modules using the PythonKit now.
It asks me to set the PYTHON_LIBRARY path but I don't know how to do that.
Can anyone help me?
//
// ViewController.swift
// VideoStream
//
// Created by HeRo Gold on 7/20/19.
// Copyright © 2019 TopAce. All rights reserved.
//
import UIKit
import PythonKit
let sys = Python.import("sys")
class ViewController: UIViewController {
@IBOutlet weak var netflixView: WKWebView!
let netflixURL = URL(string: "https://www.netflix.com/login")
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let pymsl = try Python.import(name: "pymsl")
print("Python \(sys.version_info.major).\(sys.version_info.minor)")
print("Python Version: \(sys.version)")
print("Python Encoding: \(sys.getdefaultencoding().upper())")
}
}
This is error message when I run the iOS app on my iPhone
Fatal error: Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library.: file /Users/herogold/Library/Developer/Xcode/DerivedData/VideoStream-cjytedddvtktmybclqlztmfdbekk/SourcePackages/checkouts/PythonKit/PythonKit/PythonLibrary.swift, line 40
2019-07-20 23:55:00.967869+0800 VideoStream[31841:170718] Fatal error: Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library.: file /Users/herogold/Library/Developer/Xcode/DerivedData/VideoStream-cjytedddvtktmybclqlztmfdbekk/SourcePackages/checkouts/PythonKit/PythonKit/PythonLibrary.swift, line 40