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