当试图找到一种将python文件“捆绑”到.exe
中的好方法时,我遇到了pyinstaller
。我查了一下如何使用它的指南,发现了这个guide。我只是使用pip install pyinstaller
安装了pyinstaller,它似乎安装得很好,但当试图在控制台中使用pyinstaller
时,它出现了一个错误,说'pyinstaller' is not recognized as an internal or external command, operable program or batch file.
我甚至试图将文件所在的目录更改为,但仍然出现了相同的错误。当尝试通过pip再次安装时(以防发生错误),我收到以下消息:
Requirement already satisfied: pyinstaller in c:\users\[me]\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (4.1)
Requirement already satisfied: pefile>=2017.8.1; sys_platform == "win32" in c:\users\[me]\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pyinstaller) (2019.4.18)
Requirement already satisfied: altgraph in c:\users\[me]\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pyinstaller) (0.17)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\[me]\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pyinstaller) (2020.10)
Requirement already satisfied: setuptools in c:\program files\windowsapps\pythonsoftwarefoundation.python.3.9_3.9.240.0_x64__qbz5n2kfra8p0\lib\site-packages (from pyinstaller) (49.2.1)
Requirement already satisfied: pywin32-ctypes>=0.2.0; sys_platform == "win32" in c:\users\w[me]\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: future in c:\users\[me]\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pefile>=2017.8.1; sys_platform == "win32"->pyinstaller) (0.18.2)
尝试在命令
pyinstaller
前面加上python -m
:如果不起作用,请尝试使用
python3 -m
或py -m
:您可以通过在
python3
前面加前缀来执行pyinstaller
如果没有前缀,则应遵循以下方法
在Windows中,
pyinstaller
可执行文件,位于并复制
pyinstaller executable
路径并将其添加到Windows System Environment Variables
单击开始菜单中的搜索并搜索
Edit System Environment Variables
点击底部的
Environment variables
。 单击Path
并单击edit
单击
New
并在path
部分添加复制的pyinstaller executable
路径 然后单击OK
现在检查CMD中的pyinstaller
快乐编码:)
相关问题 更多 >
编程相关推荐