首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在python2.7.18上安装pyinstaller

无法在python2.7.18上安装pyinstaller
EN

Stack Overflow用户
提问于 2022-03-22 20:24:27
回答 1查看 731关注 0票数 1

我使用python2.7.18轮更新,pip也。但我还是会犯同样的错误。在相同版本的linux上,但是在windows上会出现一个错误。如何纠正此错误?

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-23 04:37:36

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

  • Install Python3或
  • 安装支持python2.7的特定pyinstaller版本,更新最多的版本是3.6.

代码语言:javascript
复制
pip install pyinstaller==3.6

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

代码语言:javascript
复制
pip3 install pyinstaller

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71578495

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档