gpt4 book ai didi

python - 关于pyinstaller的路径问题

转载 作者:太空宇宙 更新时间:2023-11-03 20:46:24 24 4
gpt4 key购买 nike

我运行的是 Windows 7 和 Python 3.7(32 位)。我正在尝试使用命令提示符来安装 pyinstaller,但遇到了我可以解决的问题。

我让它短暂工作,直到我决定更新 pyinstaller 并且失败了。在那之后,一切都乱了套。作为实习生,我花了几乎一整天的工作日试图找出问题所在,但感觉自己束手无策。我知道这是我在数小时的寻找解决方案的过程中经常被问到的问题,但我真的很挣扎。最令人沮丧的部分是我可以运行 pip,但即使它看起来已正确安装,我也无法运行 pyinstaller。

  1. 我通过“环境变量”将以下路径添加到系统路径:

C:\Users\awilliamson\AppData\Local\Programs\Python\Python37-32\Scripts

我确保编辑“路径”并在上一个路径后添加分号。这是我生成的系统路径:

C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\UCRT\;C:\Program Files\Intel\UCRT\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engie Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Users\awilliamson\AppData\Local\Programs\Python\Python37-32\Scripts

  • 添加到“Path”后,我打开命令提示符并输入以下内容并运行:

    pip安装pyinstaller

  • 这是输出:

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\awilliamson>pip install pyinstaller
    Requirement already satisfied: pyinstaller in c:\users\awilliamson\appdata\local
    \programs\python\python37-32\lib\site-packages (3.4)
    Requirement already satisfied: pywin32-ctypes in c:\users\awilliamson\appdata\lo
    cal\programs\python\python37-32\lib\site-packages (from pyinstaller) (0.2.0)
    Requirement already satisfied: setuptools in c:\users\awilliamson\appdata\local\
    programs\python\python37-32\lib\site-packages (from pyinstaller) (40.8.0)
    Requirement already satisfied: pefile>=2017.8.1 in c:\users\awilliamson\appdata\
    local\programs\python\python37-32\lib\site-packages (from pyinstaller) (2019.4.1
    8)
    Requirement already satisfied: macholib>=1.8 in c:\users\awilliamson\appdata\loc
    al\programs\python\python37-32\lib\site-packages (from pyinstaller) (1.11)
    Requirement already satisfied: altgraph in c:\users\awilliamson\appdata\local\pr
    ograms\python\python37-32\lib\site-packages (from pyinstaller) (0.16.1)
    Requirement already satisfied: future in c:\users\awilliamson\appdata\local\prog
    rams\python\python37-32\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (
    0.17.1)

    C:\Users\awilliamson>
  • 它似乎已经开始工作 - 所以我运行了:

  • 输出:

    C:\Users\awilliamson>pip

    Usage:
    pip <command> [options]

    Commands:
    install Install packages.
    download Download packages.
    uninstall Uninstall packages.
    freeze Output installed packages in requirements format.
    list List installed packages.
    show Show information about installed packages.
    check Verify installed packages have compatible dependen
    cies.
    config Manage local and global configuration.
    search Search PyPI for packages.
    wheel Build wheels from your requirements.
    hash Compute hashes of package archives.
    completion A helper command used for command completion.
    help Show help for commands.

    General Options:
    -h, --help Show help.
    --isolated Run pip in an isolated mode, ignoring
    environment variables and user configuration.
    -v, --verbose Give more output. Option is additive, and can be
    used up to 3 times.
    -V, --version Show version and exit.
    -q, --quiet Give less output. Option is additive, and can be
    used up to 3 times (corresponding to WARNING,
    ERROR, and CRITICAL logging levels).
    --log <path> Path to a verbose appending log.
    --proxy <proxy> Specify a proxy in the form
    [user:passwd@]proxy.server:port.
    --retries <retries> Maximum number of retries each connection should
    attempt (default 5 times).
    --timeout <sec> Set the socket timeout (default 15 seconds).
    --exists-action <action> Default action when a path already exists:
    (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
    --trusted-host <hostname> Mark this host as trusted, even though it does
    not have valid or any HTTPS.
    --cert <path> Path to alternate CA bundle.
    --client-cert <path> Path to SSL client certificate, a single file
    containing the private key and the certificate
    in PEM format.
    --cache-dir <dir> Store the cache data in <dir>.
    --no-cache-dir Disable the cache.
    --disable-pip-version-check
    Don't periodically check PyPI to determine
    whether a new version of pip is available for
    download. Implied with --no-index.
    --no-color Suppress colored output

    C:\Users\awilliamson>
  • 看起来还是不错的。然后我通过运行以下命令来测试 pyinstaller:

    pyinstaller

  • 这是输出:

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

    C:\Users\awilliamson>

    这些都是我在“环境变量”中的路径

    用户:

    C:\Users\awilliamson\AppData\Local\Programs\Python\Python37-32\;C:\Users\awilliamson\AppData\Local\Programs\Python\Python37-32\Scripts;%PyCharm Community Edition%

    系统:

    C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\UCRT\;C:\Program Files\Intel\UCRT\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engie Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Users\awilliamson\AppData\Local\Programs\Python\Python37-32\Scripts

    我尝试解决该问题的方法:

    1. 卸载/重新安装 Python 和 pyCharm
    2. 重新启动计算机
    3. 更新计算机
    4. 研究了系统恢复,但我认为恢复点太新了
    5. 使用 Regedit 恢复旧的路径扩展。

    最佳答案

    感谢 M. R.,我终于弄清楚了

    我确实安装了 pyinstaller;但是,它没有出现在脚本中。因此,如果您运行的是 Python 2,请使用:

    pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz

    对于 Python 3:

    pip3 install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz

    有关这方面的信息可以在以下位置找到:

    https://www.pyinstaller.org/downloads.html

    运行上面的正确代码后,pyinstaller卸载了旧版本并安装了新版本,然后出现在脚本中并再次工作。

    关于python - 关于pyinstaller的路径问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56567522/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com