Home > Software design >  Can't install pyinstaller on python2.7.18
Can't install pyinstaller on python2.7.18

Time:03-23

I use python2.7.18 wheel updated, pip too. But I still get the same error. On linux python of the same version but on windows gives an error. How can I fix this error?

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.

CodePudding user response:

In python3, there are a lot of different changes which could make newer versions on pyinstaller not work on python2. In order to fix this you would have to either do one of the following:

  • Install Python3 or
  • install a specific pyinstaller version that supports python 2.7, which the most updated one would be 3.6.
pip install pyinstaller==3.6

I would also heavily advise against using python 2 because it has reached its end of life and most people use python 3. For the few people that use python 2, they do so because they are curious, want to run some old code, or to port over old programs into python 3. (In case you want to insall pyinstaller for python3 and you have both python versions installed)

pip3 install pyinstaller

This will tell the program that you are using python 3's pip not python 2's. I hope this helped!

  • Related