我正在运行Windows 7和Python 3.7(32位)。我正在尝试使用命令提示符安装pyinstaller,但遇到了我可以解决的问题。
在决定更新pyinstaller并失败之前,我做了短暂的工作。在那之后,所有的地狱都崩溃了。作为实习生,我花了将近一整天的时间,试图弄清楚出了什么问题,并觉得自己处于机智。我知道这是我在寻求解决方案的过程中经常问到的问题,但我确实很挣扎。最令人沮丧的部分是我可以运行pip,但是即使看起来安装正确,我也无法运行pyinstaller。
我已通过“环境变量”将以下路径添加到系统路径:
C:\ Users \ awilliamson \ AppData \ Local \ Programs \ Python \ Python37-32 \ Scripts
我确保编辑“路径”,并在上一个路径之后添加分号。这是我得到的系统路径:
C:\ Program Files(x86)\ Intel \ iCLS Client \; C:\ Program Files \ Intel \ iCLS
客户端\; C:\ Windows \ system32; C:\ Windows; C:\ Windows \ System32 \ Wbem; C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \; C:\ Program
文件(x86)\ Intel \ UCRT \; C:\ Program Files \ Intel \ UCRT \; C:\ Program Files
(x86)\ Intel \ Intel(R)管理引擎组件\ DAL; C:\ Program
文件\英特尔\英特尔(R)管理引擎组件\ DAL; C:\ Program文件
(x86)\ Intel \ Intel(R)Management Engie Components \ IPT; C:\ Program
Files \ Intel \ Intel(R)管理引擎
组件\ IPT; C:\ Users \ awilliamson \ AppData \ Local \ Programs \ Python \ Python37-32 \ Scripts
添加到“路径”后,我打开命令提示符并键入以下内容并运行:
点安装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'无法识别为
内部或外部命令,可操作程序或批处理文件。
C:\ Users \ awilliamson>
这些都是我在“环境变量”中拥有的路径
用户:
C:\ Users \ awilliamson \ AppData \ Local \ Programs \ Python \ Python37-32 \; C:\ Users \ awilliamson \ AppData \ Local \ Programs \ Python \ Python37-32 \ Scripts;%PyCharm
社区版%
系统:
C:\ Program Files(x86)\ Intel \ iCLS Client \; C:\ Program Files \ Intel \ iCLS
客户端\; C:\ Windows \ system32; C:\ Windows; C:\ Windows \ System32 \ Wbem; C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \; C:\ Program
文件(x86)\ Intel \ UCRT \; C:\ Program Files \ Intel \ UCRT \; C:\ Program Files
(x86)\ Intel \ Intel(R)管理引擎组件\ DAL; C:\ Program
文件\英特尔\英特尔(R)管理引擎组件\ DAL; C:\ Program文件
(x86)\ Intel \ Intel(R)Management Engie Components \ IPT; C:\ Program
Files \ Intel \ Intel(R)管理引擎
组件\ IPT; C:\ Users \ awilliamson \ AppData \ Local \ Programs \ Python \ Python37-32 \ Scripts
我尝试解决此问题的方法:
卸载/重新安装Python和pyCharm
重新启动电脑
更新电脑
研究了系统恢复,但是我认为恢复点太新了
使用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/