zsh: command not found: pyinstaller

使用pip3安装pyinstaller,如下图已安装成功

mac@fwkmbp ~ % pip3 install pyinstaller
Requirement already satisfied: pyinstaller in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (5.6.2)
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pyinstaller) (65.5.0)
Requirement already satisfied: altgraph in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pyinstaller) (0.17.3)
Requirement already satisfied: pyinstaller-hooks-contrib>=2021.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pyinstaller) (2022.13)
Requirement already satisfied: macholib>=1.8 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pyinstaller) (1.16.2)

然后使用pyinstaller -f xx.py打包某python文件,发现报错,如下

zsh: command not found: pyinstaller

编辑当前用户下的.zshrc文件

vim .zshrc

加入如下配置

#引用其他环境变量配置文件
source ~/.bash_profileexport 

PATH="$PATH":"/Library/Frameworks/Python.framework/Versions/3.11/bin"

然后使配置生效

source .zshrc

然后输入

mac@fwkmbp ~ % pyinstaller --help
usage: pyinstaller [-h] [-v] [-D] [-F] [--specpath DIR] [-n NAME] [--add-data ] [--add-binary ] [-p DIR] [--hidden-import MODULENAME]
                   [--collect-submodules MODULENAME] [--collect-data MODULENAME] [--collect-binaries MODULENAME] [--collect-all MODULENAME] [--copy-metadata PACKAGENAME]
                   [--recursive-copy-metadata PACKAGENAME] [--additional-hooks-dir HOOKSPATH] [--runtime-hook RUNTIME_HOOKS] [--exclude-module EXCLUDES] [--key KEY] [--splash IMAGE_FILE]
                   [-d {all,imports,bootloader,noarchive}] [--python-option PYTHON_OPTION] [-s] [--noupx] [--upx-exclude FILE] [-c] [-w]
                   [-i ] [--disable-windowed-traceback] [--version-file FILE] [-m ] [--no-embed-manifest] [-r RESOURCE]
                   [--uac-admin] [--uac-uiaccess] [--win-private-assemblies] [--win-no-prefer-redirects] [--argv-emulation] [--osx-bundle-identifier BUNDLE_IDENTIFIER]
                   [--target-architecture ARCH] [--codesign-identity IDENTITY] [--osx-entitlements-file FILENAME] [--runtime-tmpdir PATH] [--bootloader-ignore-signals] [--distpath DIR]
                   [--workpath WORKPATH] [-y] [--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEVEL]
                   scriptname [scriptname ...]

则可以用pyinstaller进行打包了

over

thanks!

你可能感兴趣的:(mac,python,macos,linux,运维,python,打包)