Pyinstaller is not recognized as internal or exter

2020-05-28 06:37发布

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>

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>

How to solve this?

5条回答
\"骚年 ilove
2楼-- · 2020-05-28 07:12

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

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

查看更多
闹够了就滚
3楼-- · 2020-05-28 07:22

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

查看更多
虎瘦雄心在
4楼-- · 2020-05-28 07:29

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

查看更多
▲ chillily
5楼-- · 2020-05-28 07:29

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.

查看更多
老娘就宠你
6楼-- · 2020-05-28 07:36

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.

查看更多
登录 后发表回答