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
Pyinstaller is not recognized as internal or external command
提问by user8533214
I am trying to use pyinstaller
in 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
回答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\Scripts
and paste it in:
environment varibales> system varibales> path
and 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。