有人使用Jython吗?有人可以给我指示吗?请 网上关于Jython的信息很少
package com.example.jython_lirbra;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import org.python.util.PythonInterpreter;
import java.util.Properties;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.exec("days=('mod','Tue','Wed','Thu','Fri','Sat','Sun'); ");
interpreter.exec("print days;");
}
}
遇到了著名的“无模块命名站点”问题。 我的错误日志:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.jython_lirbra, PID: 26401
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.jython_lirbra/com.example.jython_lirbra.MainActivity}: ImportError: Cannot import site module and its dependencies: No module named site
Determine if the following attributes are correct:
* sys.path: ['__classpath__', '__pyclasspath__/']
This attribute might be including the wrong directories, such as from CPython
* sys.prefix: null
This attribute is set by the system property python.home, although it can
be often automatically determined by the location of the Jython jar file
You can use the -S option or python.import.site=false to not import the site module