pyinstaller 错误。未找到路径。有谁知道这是什么吗?

问题描述 投票:0回答:2

我使用 pyinstaller 从我的 .py 文件创建一个 exe。

从一秒到另一秒,它开始不起作用。当我安装 pyinstaller 时,出现下一个警告:

WARNING: The scripts pyi-archive_viewer.exe, pyi-bindepend.exe, pyi-grab_version.exe, pyi-makespec.exe, pyi-set_version.exe and pyinstaller.exe are installed in 'C:\Users\gergr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3
.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

当我尝试将其创建为 exe 时,会出现 ext:

pyinstaller : The term 'pyinstaller' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pyinstaller --onefile main.py
+ ~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (pyinstaller:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

有人知道这是什么吗?

python pycharm pyinstaller
2个回答
0
投票

这是一个 PATH 问题,您必须在路径变量中添加脚本的路径。像这样:

C:\Users[用户名]\AppData\Local\Programs\Python\Python36-32\Scripts

要了解如何编辑路径,请前往此处: https://www.java.com/en/download/help/path.html


0
投票

将 python 的 Scripts 文件夹的路径添加到 PATH 变量中。 或者 您可以使用虚拟环境来使用 pyinstaller。

© www.soinside.com 2019 - 2024. All rights reserved.