You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to install numpy as an additional packages? #19
Hi, I have tried installing numpy and gave the installed numpy path but every time I run the code I am getting this error ->
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
This is the code I am running ->
func runPythonCode() {
// Initialize the Python interpreter
Py_Initialize()
let pythonModulesPath = "/Users/anmol.varshney/Documents/python_modules/"
// Python code as a string
let pythonCode = """
import sys
sys.path.append('\(pythonModulesPath)')
import numpy as np
array1 = np.array([1, 2, 3, 4, 5])
array2 = np.array([10, 20, 30, 40, 50])
print(array1)
print('Hello from Python!')
"""
// Execute the Python code
pythonCode.withCString { cString in
PyRun_SimpleString(cString)
}
// Finalize the Python interpreter
Py_Finalize()
}
Please help me how to import numpy or any 3rd party python packages in this?
Activity