写在前面,如果是用win10系统的用户,一定要先通过管理员模式打开命令窗口,我是直接按 win + x 键,选择 "Windows Powershell(管理员)",否则会提示: [Errno 13] Permission denied:
下面是在管理员模式下通过 pip 命令安装失败
从下面错误来看,是安装build的依赖失败,但具体是哪些也不清楚,网上找也没有类似错误的解决办法,大都都是下载setup.py文件来安装
1 Windows PowerShell2 版权所有 (C) Microsoft Corporation。保留所有权利。3
4 PS C:\Windows\system32>pip install PyInstaller5 Collecting PyInstaller6 Downloading https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef39a0cc/PyInstaller-3.4.tar.gz (3.5MB)7 100% |████████████████████████████████| 3.5MB 44kB/s8 Installing build dependencies ... error9 Complete output from command "c:\program files\python3\python.exe" "c:\program files\python3\lib\site-packages\pip" install --ignore-installed --no-user --prefix C:\Users\S~1.WU\AppData\Local\Temp\pip-build-env-0g2rl8se\overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --setuptools wheel:10 Traceback (most recent call last):11 File "c:\program files\python3\lib\runpy.py", line 193, in_run_module_as_main12 "__main__", mod_spec)13 File "c:\program files\python3\lib\runpy.py", line 85, in_run_code14 exec(code, run_globals)15 File "c:\program files\python3\lib\site-packages\pip\__main__.py", line 16, in
16 from pip._internal import main as _main #isort:skip # noqa
17 File "c:\program files\python3\lib\site-packages\pip\_internal\__init__.py", line 40, in
18 from pip._internal.cli.autocompletion importautocomplete19 File "c:\program files\python3\lib\site-packages\pip\_internal\cli\autocompletion.py", line 8, in
20 from pip._internal.cli.main_parser importcreate_main_parser21 File "c:\program files\python3\lib\site-packages\pip\_internal\cli\main_parser.py", line 12, in
22 from pip._internal.commands import(23 File "c:\program files\python3\lib\site-packages\pip\_internal\commands\__init__.py", line 6, in
24 from pip._internal.commands.completion importCompletionCommand25 File "c:\program files\python3\lib\site-packages\pip\_internal\commands\completion.py", line 6, in
26 from pip._internal.cli.base_command importCommand27 File "c:\program files\python3\lib\site-packages\pip\_internal\cli\base_command.py", line 25, in
28 from pip._internal.index importPackageFinder29 File "c:\program files\python3\lib\site-packages\pip\_internal\index.py", line 41, in
30 from pip._internal.wheel importWheel31 File "c:\program files\python3\lib\site-packages\pip\_internal\wheel.py", line 7, in
32 importcompileall33 File "c:\program files\python3\lib\compileall.py", line 20, in
34 from concurrent.futures importProcessPoolExecutor35 File "c:\program files\python3\lib\site-packages\concurrent\futures\__init__.py", line 8, in
36 from concurrent.futures._base import(FIRST_COMPLETED,37 File "c:\program files\python3\lib\site-packages\concurrent\futures\_base.py", line 381
38 raiseexception_type, self._exception, self._traceback39 ^
40 SyntaxError: invalid syntax41
42 ----------------------------------------
43 Command ""c:\program files\python3\python.exe" "c:\program files\python3\lib\site-packages\pip"install --ignore-installed --no-user --prefix C:\Users\S~1.WU\AppData\Local\Temp\pip-build-env-0g2rl8se\overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel" failed with error code 1 in None
下面就介绍用setup.py文件进行安装
2、我安装的是3.4版本,直接下载:pyinstaller 3.4
3、下载到本地后,直接解压,然后通过管理员模式打开命令窗口,用 cd 命令切换至 pyinstaller的解压路径,然后运行 python setup.py install
4、安装的过程会花点时间,就耐心等待吧,出现下面的提示表明安装成功
Best match: setuptools 40.8.0
Adding setuptools 40.8.0 to easy-install.pth file
Installing easy_install-script.py script to C:\Program Files\Python3\Scripts
Installing easy_install.exe script to C:\Program Files\Python3\Scripts
Installing easy_install-3.6-script.py script to C:\Program Files\Python3\Scripts
Installing easy_install-3.6.exe script to C:\Program Files\Python3\Scripts
Using c:\program files\python3\lib\site-packages
Finished processing dependencies for PyInstaller==3.4
5、通过 pip show pyinstaller查看详细信息进一步确认安装情况
PS C:\Windows\system32> pip show pyinstaller
Name: pyinstaller
Version: 3.4
Summary: PyInstaller bundles a Python application and all its dependencies into a single package.
Home-page: http://www.pyinstaller.org
Author: Giovanni Bajo, Hartmut Goebel, David Vierra, David Cortesi, Martin Zibricky
Author-email: pyinstaller@googlegroups.com
License: GPL license with a special exception which allows to use PyInstaller to build and distribute non-free programs (including commercial ones)
Location: c:\program files\python3\lib\site-packages\pyinstaller-3.4-py3.6.egg
Requires: setuptools, pefile, macholib, altgraph, pywin32-ctypes
Required-by: