繁体   English   中英

无法在python2.7.18上安装pyinstaller

[英]Can't install pyinstaller on python2.7.18

我也使用更新的 python2.7.18 wheel,pip。 但我仍然遇到同样的错误。 同版本的linux python 但是windows 报错。 我该如何解决这个错误?

Collecting pyinstaller
  Using cached pyinstaller-4.1.tar.gz (3.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Python27\python.exe' 'C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\vinchi\appdata\local\temp\tmpbzv06v'
       cwd: c:\users\vinchi\appdata\local\temp\pip-install-x1nttk\pyinstaller
  Complete output (19 lines):
  Traceback (most recent call last):
    File "C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
      main()
    File "C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "c:\users\vinchi\appdata\local\temp\pip-build-env-avmgyd\overlay\Lib\site-packages\setuptools\build_meta.py", line 146, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "c:\users\vinchi\appdata\local\temp\pip-build-env-avmgyd\overlay\Lib\site-packages\setuptools\build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "c:\users\vinchi\appdata\local\temp\pip-build-env-avmgyd\overlay\Lib\site-packages\setuptools\build_meta.py", line 243, in run_setup
      self).run_setup(setup_script=setup_script)
    File "c:\users\vinchi\appdata\local\temp\pip-build-env-avmgyd\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 63
      file=sys.stderr)
          ^
  SyntaxError: invalid syntax
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Python27\python.exe' 'C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\vinchi\appdata\local\temp\tmpbzv06v' Check the logs for full command output.

在 python3 中,有许多不同的更改可能会使 pyinstaller 上的较新版本无法在 python2 上运行。 为了解决这个问题,您必须执行以下操作之一:

  • 安装 Python3 或
  • 安装支持 python 2.7 的特定 pyinstaller 版本,最新版本为 3.6。
pip install pyinstaller==3.6

我也强烈建议不要使用 python 2,因为它已经到了生命的尽头,大多数人使用 python 3。对于少数使用 python 2 的人,他们这样做是因为他们很好奇,想运行一些旧代码,或者将旧程序移植到 python 3.(如果你想为 python3 安装 pyinstaller 并且你安装了两个 python 版本)

pip3 install pyinstaller

这将告诉程序您正在使用 python 3 的 pip 而不是 python 2 的。 我希望这有帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM