簡體   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