如何正确安装和使用 npm-python-shell?

问题描述

使用命令 "npm install python-shell" 安装后,我什至无法将包导入到 .js 文件中 我的目的是使用 node.js 运行一个简单的 python 脚本

浏览器出现以下错误,网上的任何文档都找不到解决方法

let {PythonShell} = require('python-shell')

async function main() {
  alert ( 'Hi')
}
main();

require('python-shell') 命令产生以下错误

util.js:602 Uncaught TypeError: The "original" argument must be of type Function
    at Object.promisify (util.js:602)
    at Object.parcelRequire.node_modules/python-shell/index.js.events (index.ts:39)
    at newRequire (python-shell_test.e31bb0bc.js:47)
    at localRequire (python-shell_test.e31bb0bc.js:53)
    at Object.parcelRequire.index.js.python-shell (index.js:17)
    at newRequire (python-shell_test.e31bb0bc.js:47)
    at python-shell_test.e31bb0bc.js:81
    at python-shell_test.e31bb0bc.js:120

我在安装了 python-3 并正常使用的 Mac /OS X 上运行代码

我将非常感谢任何帮助我找到解决方案的信息,因为没有提及此类问题。非常感谢您提前

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)