本文介绍了Pyinstaller 不被识别为内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 cmd 中使用 pyinstaller 但我收到错误:

I am trying to use pyinstaller in cmd but I receive error:

C:\Users\username>pyinstaller
'pyinstaller' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\username>

当我在 python 的 Scripts 文件夹中使用此命令时,它起作用了:

When I use this command in the Scripts folder in python , it works:

C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts>pyinstaller
usage: pyinstaller [-h] [-v] [-D] [-F] [--specpath DIR] [-n NAME]
                   [--add-data <SRC;DEST or SRC:DEST>]
                   [--add-binary <SRC;DEST or SRC:DEST>] [-p DIR]
                   [--hidden-import MODULENAME]
                   [--additional-hooks-dir HOOKSPATH]
                   [--runtime-hook RUNTIME_HOOKS] [--exclude-module EXCLUDES]
                   [--key KEY] [-d] [-s] [--noupx] [-c] [-w]
                   [-i <FILE.ico or FILE.exe,ID or FILE.icns>]
                   [--version-file FILE] [-m <FILE or XML>] [-r RESOURCE]
                   [--uac-admin] [--uac-uiaccess] [--win-private-assemblies]
                   [--win-no-prefer-redirects]
                   [--osx-bundle-identifier BUNDLE_IDENTIFIER]
                   [--distpath DIR] [--workpath WORKPATH] [-y]
                   [--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEVEL]
                   [--upx UPX]
                   scriptname [scriptname ...]
pyinstaller: error: the following arguments are required: scriptname

C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts>

如何解决这个问题?

推荐答案

您必须修改 User PATH 环境变量以包含 C:\Users\[USERNAME]\AppData\Local\Programs\Python\Python36-32\Scripts.

You have to modify your User PATH environment variable to include C:\Users\[USERNAME]\AppData\Local\Programs\Python\Python36-32\Scripts.

有关如何添加/修改 PATH 环境变量的信息,请参阅this.

For how to add/modify your PATH environment variables, see this.

这篇关于Pyinstaller 不被识别为内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

查看更多