我想启动我的 python 脚本,它使用 nltk 和 stanford tagger 分析文本数据。问题是我无权启动复制的 java.exe。
启动 stanfordtagger 的代码是:
#set java path in environment variables
java_path = fct.lib_dir + "java.exe"
os.environ['JAVAHOME'] = java_path
#load stanford NER
sn = StanfordNERTagger(
fct.lib_dir+"german.distsim.crf.ser.gz",
path_to_jar=fct.lib_dir+"stanford-ner.jar")
这是错误:
com.chaquo.python.PyException: PermissionError: [Errno 13] Permission denied: '/data/user/0/com.pro.useyournotes/files/chaquopy/AssetFinder/app/library_files/java.exe'
at <python>.subprocess._execute_child(subprocess.py:1702)
at <python>.subprocess.__init__(subprocess.py:854)
at <python>.nltk.internals.java(internals.py:132)
at <python>.nltk.tag.stanford.tag_sents(stanford.py:113)
at <python>.nltk.tag.stanford.tag(stanford.py:91)
at <python>.uyn_pre_processing.get_tagged_stanford_corpus(uyn_pre_processing.py:185)
at <python>.uyn_analysis_workflow.analyse_new_data(uyn_analysis_workflow.py:63)
at <python>.uyn_main.main(uyn_main.py:268)
at <python>.chaquopy_java.call(chaquopy_java.pyx:285)
at <python>.chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrows(chaquopy_java.pyx:257)
at com.chaquo.python.PyObject.callAttrThrows(Native Method)
at com.chaquo.python.PyObject.callAttr(PyObject.java:209)
at com.pro.useyournotes.MainActivity.getPythonHello(MainActivity.kt:70)
at com.pro.useyournotes.MainActivity.onCreate(MainActivity.kt:59)
at android.app.Activity.performCreate(Activity.java:7458)
at android.app.Activity.performCreate(Activity.java:7448)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1286)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3409)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3614)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:86)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)
at android.os.Handler.dispatchMessage(Handler.java:112)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7625)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
我怎么解决这个问题?或者是否有任何其他选项可以访问复制的 java.exe(从:“C:\Program Files\Java\jdk-14\bin\java.exe”到方向:lib_dir = join(dirname( file ),“library_files /" ) ) python 脚本中的窗口?
java_path = fct.lib_dir + "java.exe"