写在前面,如果是用win10系统的用户,一定要先通过管理员模式打开命令窗口,我是直接按 win + x 键,选择 "Windows Powershell(管理员)",否则会提示: [Errno 13] Permission denied:
下面是在管理员模式下通过 pip 命令安装失败
从下面错误来看,是安装build的依赖失败,但具体是哪些也不清楚,网上找也没有类似错误的解决办法,大都都是下载setup.py文件来安装
1 Windows PowerShell 2 版权所有 (C) Microsoft Corporation。保留所有权利。 3 4 PS C:\Windows\system32> pip install PyInstaller 5 Collecting PyInstaller 6 Downloading https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef39a0cc/PyInstaller-3.4.tar.gz (3.5MB) 7 100% |████████████████████████████████| 3.5MB 44kB/s 8 Installing build dependencies ... error 9 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_main 12 "__main__", mod_spec) 13 File "c:\program files\python3\lib\runpy.py", line 85, in _run_code 14 exec(code, run_globals) 15 File "c:\program files\python3\lib\site-packages\pip\__main__.py", line 16, in <module> 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 <module> 18 from pip._internal.cli.autocompletion import autocomplete 19 File "c:\program files\python3\lib\site-packages\pip\_internal\cli\autocompletion.py", line 8, in <module> 20 from pip._internal.cli.main_parser import create_main_parser 21 File "c:\program files\python3\lib\site-packages\pip\_internal\cli\main_parser.py", line 12, in <module> 22 from pip._internal.commands import ( 23 File "c:\program files\python3\lib\site-packages\pip\_internal\commands\__init__.py", line 6, in <module> 24 from pip._internal.commands.completion import CompletionCommand 25 File "c:\program files\python3\lib\site-packages\pip\_internal\commands\completion.py", line 6, in <module> 26 from pip._internal.cli.base_command import Command 27 File "c:\program files\python3\lib\site-packages\pip\_internal\cli\base_command.py", line 25, in <module> 28 from pip._internal.index import PackageFinder 29 File "c:\program files\python3\lib\site-packages\pip\_internal\index.py", line 41, in <module> 30 from pip._internal.wheel import Wheel 31 File "c:\program files\python3\lib\site-packages\pip\_internal\wheel.py", line 7, in <module> 32 import compileall 33 File "c:\program files\python3\lib\compileall.py", line 20, in <module> 34 from concurrent.futures import ProcessPoolExecutor 35 File "c:\program files\python3\lib\site-packages\concurrent\futures\__init__.py", line 8, in <module> 36 from concurrent.futures._base import (FIRST_COMPLETED, 37 File "c:\program files\python3\lib\site-packages\concurrent\futures\_base.py", line 381 38 raise exception_type, self._exception, self._traceback 39 ^ 40 SyntaxError: invalid syntax 41 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文件进行安装
1、先下载 pyinstaller的安装文件,下载地址:http://www.pyinstaller.org/downloads.html
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: