代码之家  ›  专栏  ›  技术社区  ›  XManit

无法在python2上安装pyinstaller。7.18

  •  0
  • XManit  · 技术社区  · 4 年前

    我用蟒蛇2。7.18 轮子也更新了,皮普。但我还是犯了同样的错误。在相同版本的linux上,但在windows上,python给出了一个错误。如何修复此错误?

    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.
    
    0 回复  |  直到 4 年前
        1
  •  0
  •   jordanDixon    4 年前

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

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

    我还强烈建议不要使用Python2,因为它已经到了生命的尽头,大多数人都在使用Python3。对于少数使用Python2的人来说,他们这么做是因为好奇,想运行一些旧代码,或者想把旧程序移植到Python3中。 (如果您想要安装所有python3的pyinstaller,并且已经安装了两个python版本)

    pip3 install pyinstaller
    

    这将告诉程序您使用的是Python3的pip而不是Python2的pip。我希望这会有所帮助!