python - 无法在 Windows 上使用 pypmml 加载 pmml 文件。获取 FileNotFoundError: [WinError 2] 系统找不到指定的文件
问题描述
我尝试安装和使用pypmml库来打开和评分 pmml 文件。我在 Windows 上使用 jupyter 笔记本。当我运行此代码 -model = Model.load('single_iris_dectree.xml')
时,我遇到了错误。但是如果我尝试在 Mac 上运行它,它运行得非常好。是否有另一种方法来加载和评分 pmml 文件?
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-11-00bc89b72cd3> in <module>
----> 1 a = Model.load(p)
C:\ProgramData\Anaconda3\lib\site-packages\pypmml\model.py in load(cls, f)
227 # Check if a file path
228 if os.path.exists(model_content):
--> 229 model = cls.fromFile(model_content)
230 else:
231 model = cls.fromString(model_content)
C:\ProgramData\Anaconda3\lib\site-packages\pypmml\model.py in fromFile(cls, name)
183 def fromFile(cls, name):
184 """Load a model from PMML file with given pathname"""
--> 185 pc = PMMLContext.getOrCreate()
186 try:
187 java_model = pc._jvm.org.pmml4s.model.Model.fromFile(name)
...........
C:\ProgramData\Anaconda3\lib\site-packages\py4j\java_gateway.py in launch_gateway(port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth, cwd, return_proc)
326
327 proc = Popen(command, stdout=PIPE, stdin=PIPE, stderr=stderr,
--> 328 cwd=kwargs.get('cwd',None), **popen_kwargs)
329
330 # Determine which port the server started on (needed to support
C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
798 c2pread, c2pwrite,
799 errread, errwrite,
--> 800 restore_signals, start_new_session)
801 except:
802 # Cleanup if the child failed starting.
C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
1205 env,
1206 os.fspath(cwd) if cwd is not None else None,
-> 1207 startupinfo)
1208 finally:
1209 # Child is launched. Close the parent's copy of those pipe
FileNotFoundError: [WinError 2] The system cannot find the file specified
解决方案
推荐阅读
- javascript - jQuery On Change 方法不起作用
- git - 如何将 gitlab 存储库同步到自动使用 ssh 的远程服务器
- node.js - 如何使用 Node js 将文件正确上传到 OneDrive?无需前端身份验证即可获取访问令牌
- rust - wasm-pack 代码中的 Rust 导入导致 JS 错误
- openssl - openSSL SSL_CTX_set1_sigalgs() API 返回 0(失败)
- javascript - 如何单击父 div 内的所有链接?
- node.js - node.js 服务器:服务于虚拟子目录
- mysql - 当在 SELECT 中使用计数变量时,有人可以解释 MySQL 中 ORDER BY 和 SELECT 的执行顺序吗?
- python - 如何使用 pods/exec Api-Group 将文件从远程 pod 复制到当前 pod [远程文件是 pcap]
- javascript - 将电子窗口从左下角调整到右上角?