【发布时间】:2020-07-05 13:21:50
【问题描述】:
我正在使用chaquopy 演示在 android 中运行 python。
(取自 GitHub https://github.com/ericdecanini/HelloChaquopy)
我的 test1 函数返回 string。
当我添加import numpy as np 行时,应用程序停止运行。
在我得到的 logcat 中:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ericdecanini.chaquopytesttwo/com.ericdecanini.chaquopytesttwo.MainActivity}: com.chaquo.python.PyException: ModuleNotFoundError: No module named 'numpy'`
请让我知道我缺少什么。
import numpy as np
import time
import math
def test1():
x = math.sin(3.14159/2.0)
str1 = "%.2f" % x
str2 = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())
return " --- OK --" + str1 + "\n --- " +str2 + "\n --- "
注意:当我将导入注释掉到 numpy 时,它运行正常。
【问题讨论】:
标签: python android numpy chaquopy