Python Pyinstaller 不被识别为内部或外部命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45951964/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 17:22:05  来源:igfitidea点击:

Pyinstaller is not recognized as internal or external command

pythonpyinstaller

提问by user8533214

I am trying to use pyinstallerin cmd but I receive error:

我正在尝试pyinstaller在 cmd 中使用,但收到错误消息:

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

C:\Users\username>

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

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

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>

How to solve this?

如何解决这个问题?

回答by user10089632

you have to modify your PATH environ to include C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts>if you don't know how to do it look here
good luck

你必须修改PATH ENVIRON包括C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts>,如果你不知道如何做到这一点看这里
好运气

回答by Manan

Copy 'pyinstaller.exe' to the folder you have the .py file you want to convert. When you are done, just delete 'pyinstaller.exe'. Good luck.

将“pyinstaller.exe”复制到您要转换的 .py 文件所在的文件夹中。完成后,只需删除“pyinstaller.exe”即可。祝你好运。

回答by Eli

For Python 3.7, you will have to add the Scripts folder from AppData/Roaming (%appdata%) to the PATH variable.

对于 Python 3.7,您必须将 AppData/Roaming (%appdata%) 中的 Scripts 文件夹添加到 PATH 变量。

C:\Users\%USERNAME%\AppData\Roaming\Python\Python37\Scripts

C:\Users\%USERNAME%\AppData\Roaming\Python\Python37\Scripts

回答by Niraj Panchasara

if you cannot do anything or you have less time, you can make the virtual environment and install pyinstaller there, then generate executable file

如果你什么都做不了,或者你的时间不多,你可以制作虚拟环境并在那里安装pyinstaller,然后生成可执行文件

回答by prathamesh mali

Copy youe script folder's path C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scriptsand paste it in: environment varibales> system varibales> pathand save it. Then restart your PC and try running pyinsatller from anywhere it will work.

复制您脚本文件夹的路径C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts并将其粘贴到: environment varibales> system varibales> path并保存。然后重新启动您的 PC 并尝试从它可以工作的任何地方运行 pyinsatller。