【问题标题】:Can't run pyinstaller on macos from zsh after installing it安装后无法从 zsh 在 macOS 上运行 pyinstaller
【发布时间】:2021-05-21 20:26:56
【问题描述】:

我使用pip3 install pyinstaller成功安装了pyinstaller

Requirement already satisfied: pyinstaller in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (4.2)
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyinstaller) (49.2.1)
Requirement already satisfied: altgraph in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyinstaller) (0.17)
Requirement already satisfied: macholib>=1.8; sys_platform == "darwin" in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyinstaller) (1.14)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyinstaller) (2020.11)

顺便说一句,我的echo $PATH 返回:

/Users/apple/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin

但是,当我尝试在同一目录中的终端中运行以下代码时,它不起作用:

apple@apples-MBP-2 app4.1_using_OOP % pyinstaller --onefile --windowed frontend.py

它有错误:

zsh: command not found: pyinstaller

我尝试了很多方法,包括:

  1. 将 pip 降级到 18.1 并再次运行 pip3 install pyinstaller
  2. 使用了apple@apples-MBP-2 app4.1_using_OOP % python -m PyInstaller frontend.py,它确实可以运行,并且有一个光盘文件夹,其中有一个名为frontend.app 的文件,但我无法打开它。

问题:

  1. 为什么有时候我可以直接使用pip3下载的模块,有时候却不能?
  2. 如果我想添加到我的$PATH,我要添加/Library/Frameworks吗?

【问题讨论】:

    标签: python python-3.x macos pyinstaller


    【解决方案1】:

    我有同样的问题。这个命令对我有用:

    python3 -m PyInstaller your_script.py

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-01
      • 2020-05-29
      • 2021-12-28
      • 2020-02-26
      • 2021-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多