从java源代码执行安装在python虚拟环境工具中的python cli工具时出现“无法打开文件”错误

kx1ctssn  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(204)

我正在尝试执行python CLI tool 从java源代码安装在python虚拟环境中,如下所示。 Process pytype_gen = Runtime.getRuntime().exec("/Users//Documents/pytestenv/bin/python3.7 pytype "+ file_path); 在这里, "/Users//Documents/pytestenv/bin/python3.7 pytype 是python虚拟环境和 pytype 是我想从java源代码执行的cli工具。
这给了我以下错误。 /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'pytype': [Errno 2] No such file or directory 我已经安装了工具 pytype 在位于 "/Users//Documents/pytestenv/bin/python" . 然而,调用 Runtime.getRuntime().exec() 搜索工具 pytype 在不同的位置(请参阅错误)。
使用正确吗 Runtime.getRuntime().exec() ,以便执行安装在虚拟环境中的python后端工具?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题