【发布时间】:2020-07-17 11:39:17
【问题描述】:
我正在使用电子应用程序使用 python-shell 运行 python 脚本。我已将 pythonPath 设置为我的 anaconda 环境,如下所示。这在我运行应用程序时可以找到,但在使用 electron-builder 打包应用程序后,它显示以下错误:没有找到这样的文件或目录即使我在同一台 PC 上使用绝对路径。
const {PythonShell} = require('python-shell');
const path = require('path');
const options = {
mode: 'text',
pythonPath: 'C:/Users/nauma/.conda/envs/YOLO/python.exe',
pythonOptions: ['-u'], // get print results in real-time
scriptPath: path.join(__dirname, '/build/engine/')
};
PythonShell.run('index.py', options, function (err, res) {
if (err) throw err;
console.log(res);
});
构建应用后的异常如下所示:
[
【问题讨论】:
标签: python electron electron-builder