【问题标题】:What is the difference between "python" and "pythonw" in the mac Terminal?mac终端中的“python”和“pythonw”有什么区别?
【发布时间】:2019-08-15 00:55:17
【问题描述】:

我对 Python 编程相当陌生,我一直在使用终端运行我的代码,没有任何问题。通常通过键入 python {filename} 来运行它。

但是,最近我收到了这个错误:

ImportError:Python 未作为框架安装。如果没有将 Python 作为框架安装,Mac OS X 后端将无法正常运行。有关在 Mac OS X 上将 Python 作为框架安装的更多信息,请参阅 Python 文档。请重新安装 Python 作为框架,或尝试使用其他后端之一。如果您使用的是 (Ana)Conda,请安装 python.app 并将“python”的使用替换为“pythonw”。有关更多信息,请参阅 Matplotlib 常见问题解答中的“在 OSX 上使用 Matplotlib”。

然后我将 python {filename} 更改为 pythonw {filename} 并且代码有效。有人可以通过添加 w 让我了解这个错误以及为什么它会起作用吗?

【问题讨论】:

  • 查看手册页。在终端输入man pythonw.

标签: python-3.x macos terminal


【解决方案1】:

pythonw - 运行允许 GUI 的 python 脚本。根据 pythonw 的手册页。

【讨论】:

    猜你喜欢
    • 2018-11-26
    • 1970-01-01
    • 2014-05-06
    • 2011-12-24
    • 1970-01-01
    • 1970-01-01
    • 2014-05-19
    • 2017-12-06
    相关资源
    最近更新 更多