微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决如何正确安装和使用 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 举报,一经查实,本站将立刻删除。