无法使用 pip 安装 pyinstaller

Posted

技术标签:

【中文标题】无法使用 pip 安装 pyinstaller【英文标题】:Cannot install pyinstaller using pip 【发布时间】:2014-11-25 23:23:30 【问题描述】:

我只是想了解如何安装 Pyinstaller。也许有人可以给我一些建议,因为我肯定会坚持几个小时。

我正确设置了我的路径变量(我可以安装其他软件),但通常的命令不起作用:

pip install pyinstaller

这是错误

  if sys.maxint > 2L ** 32:

                 ^

  SyntaxError: invalid syntax

在下面的输出中...

    ------------------------------------------------------------
C:\Python34\Scripts\pip run on 11/26/14 00:09:32
Downloading/unpacking pyinstaller
  Getting page https://pypi.python.org/simple/pyinstaller/
  URLs to search for versions for pyinstaller:
  * https://pypi.python.org/simple/pyinstaller/
  Analyzing links from page https://pypi.python.org/simple/pyinstaller/
    Found link https://pypi.python.org/packages/source/P/PyInstaller/PyInstaller-2.1.tar.gz#md5=248531f6fc94b0ffb02473321496d6d0 (from https://pypi.python.org/simple/pyinstaller/), version: 2.1
    Found link https://pypi.python.org/packages/source/P/PyInstaller/PyInstaller-2.1.zip#md5=3eb18a454311707ab7808d881e677329 (from https://pypi.python.org/simple/pyinstaller/), version: 2.1
    Found link https://pypi.python.org/packages/source/P/PyInstaller/pyinstaller-2.0.tar.bz2#md5=c62dd506bcde230d87ea11a1c316b590 (from https://pypi.python.org/simple/pyinstaller/), version: 2.0
    Found link https://pypi.python.org/packages/source/P/PyInstaller/pyinstaller-2.0.zip#md5=19350c07632e4deef5f4ecf64a556637 (from https://pypi.python.org/simple/pyinstaller/), version: 2.0
    Skipping link http://www.pyinstaller.org (from https://pypi.python.org/simple/pyinstaller/); not a file
    Skipping link http://www.pyinstaller.org/wiki#Downloads (from https://pypi.python.org/simple/pyinstaller/); not a file
    Skipping link https://sourceforge.net/projects/pyinstaller/files/ (from https://pypi.python.org/simple/pyinstaller/); not a file
  Not searching http://www.pyinstaller.org (from https://pypi.python.org/simple/pyinstaller/) for files because external urls are disallowed.
  Not searching http://www.pyinstaller.org (from https://pypi.python.org/simple/pyinstaller/) for files because external urls are disallowed.
  Not searching http://www.pyinstaller.org (from https://pypi.python.org/simple/pyinstaller/) for files because external urls are disallowed.
  Not searching http://www.pyinstaller.org (from https://pypi.python.org/simple/pyinstaller/) for files because external urls are disallowed.
  Not searching http://www.pyinstaller.org/wiki#Downloads (from https://pypi.python.org/simple/pyinstaller/) for files because external urls are disallowed.
  Not searching http://www.pyinstaller.org/wiki#Downloads (from https://pypi.python.org/simple/pyinstaller/) for files because external urls are disallowed.
  Not searching https://sourceforge.net/projects/pyinstaller/files/ (from https://pypi.python.org/simple/pyinstaller/) for files because external urls are disallowed.
  Not searching https://sourceforge.net/projects/pyinstaller/files/ (from https://pypi.python.org/simple/pyinstaller/) for files because external urls are disallowed.
  Using version 2.1 (newest of versions: 2.1, 2.1, 2.0, 2.0)
  Downloading from URL https://pypi.python.org/packages/source/P/PyInstaller/PyInstaller-2.1.tar.gz#md5=248531f6fc94b0ffb02473321496d6d0 (from https://pypi.python.org/simple/pyinstaller/)
  Running setup.py (path:C:\Users\Michael\AppData\Local\Temp\pip_build_Michael\pyinstaller\setup.py) egg_info for package pyinstaller
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "C:\Users\Michael\AppData\Local\Temp\pip_build_Michael\pyinstaller\setup.py", line 18, in <module>
        from PyInstaller import get_version
      File "C:\Users\Michael\AppData\Local\Temp\pip_build_Michael\pyinstaller\PyInstaller\__init__.py", line 32, in <module>
        from PyInstaller import compat
      File "C:\Users\Michael\AppData\Local\Temp\pip_build_Michael\pyinstaller\PyInstaller\compat.py", line 129
        if sys.maxint > 2L ** 32:
                         ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "C:\Users\Michael\AppData\Local\Temp\pip_build_Michael\pyinstaller\setup.py", line 18, in <module>

    from PyInstaller import get_version

  File "C:\Users\Michael\AppData\Local\Temp\pip_build_Michael\pyinstaller\PyInstaller\__init__.py", line 32, in <module>

    from PyInstaller import compat

  File "C:\Users\Michael\AppData\Local\Temp\pip_build_Michael\pyinstaller\PyInstaller\compat.py", line 129

    if sys.maxint > 2L ** 32:

                     ^

SyntaxError: invalid syntax

----------------------------------------
Cleaning up...
  Removing temporary dir C:\Users\Michael\AppData\Local\Temp\pip_build_Michael...
Command python setup.py egg_info failed with error code 1 in C:\Users\Michael\AppData\Local\Temp\pip_build_Michael\pyinstaller
Exception information:
Traceback (most recent call last):
  File "c:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "c:\Python34\lib\site-packages\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "c:\Python34\lib\site-packages\pip\req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "c:\Python34\lib\site-packages\pip\req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "c:\Python34\lib\site-packages\pip\util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command python setup.py egg_info failed with error code 1 in C:\Users\Michael\AppData\Local\Temp\pip_build_Michael\pyinstaller

【问题讨论】:

我认为它与某些版本的 python 不兼容。还有相关***.com/questions/26215685/… 该项目尚不兼容 Python 3。 【参考方案1】:

你可以试试github上的pyinstaller python3分支。

pip3 install https://github.com/pyinstaller/pyinstaller/archive/python3.zip

【讨论】:

可能与已死分支的链接有关:github.com/pyinstaller/pyinstaller/issues/1417

以上是关于无法使用 pip 安装 pyinstaller的主要内容,如果未能解决你的问题,请参考以下文章

生成的 windows exe (pyinstaller) 无法加载 _cffi_backend

无法安装 pyspark

如何在win7下安装python包工具pip

Python使用pip报错和安装pyinstaller报错

PyInstaller,如何包含 pip 安装的外部包中的数据文件?

pip安装pyinstaller失败的解决方法