首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Python2.7中安装包时返回语法错误

在Python2.7中安装包时返回语法错误
EN

Stack Overflow用户
提问于 2022-03-20 19:36:28
回答 3查看 692关注 0票数 0

我试图在葡萄酒中安装Python包,但它一直给我内部语法错误。当我试图安装pyinstaller时,它给了我以下内容:

代码语言:javascript
复制
C:\>pip install pyinstaller
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
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\jackpy\temp\tmpo_ofkx'
       cwd: c:\users\jackpy\temp\pip-install-tjtlkl\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\jackpy\temp\pip-build-env-wvrvge\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\jackpy\temp\pip-build-env-wvrvge\overlay\Lib\site-packages\setuptools\build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "c:\users\jackpy\temp\pip-build-env-wvrvge\overlay\Lib\site-packages\setuptools\build_meta.py", line 243, in run_setup
      self).run_setup(setup_script=setup_script)
    File "c:\users\jackpy\temp\pip-build-env-wvrvge\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\jackpy\temp\tmpo_ofkx' Check the logs for full command output.

我尝试过使用get-pip.py卸载和重新安装,并且始终是相同的错误。

我正在使用Python2.7.18和Wine4.0。有人能告诉我怎么解决这个问题吗?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2022-03-21 10:47:43

如果绝对需要使用Python2.7,那么使用上一个受支持的版本仍然有效。请尝试

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

另见:How do you downgrade pyinstaller using pip?

票数 0
EN

Stack Overflow用户

发布于 2022-03-20 19:42:41

据我从pyinstaller网站上可以看到,他们已经放弃了版本4.0对python2.7的支持,您正在尝试安装4.1.0版本(https://pyinstaller.readthedocs.io/en/stable/)。

Finally, this version drops support for Python 2.7, which is end-of-life since January 2020.. The minimum required version is now Python 3.6.

而且,我在PyPI上没有看到任何其他可用的版本,所以您唯一的选择是将您的python升级到至少3.6版本。

祝你好运!

票数 1
EN

Stack Overflow用户

发布于 2022-03-20 20:11:08

  1. 获得python的更新版本。你的版本太old
  2. Recently 了--我经历过这个问题,不像你的,但有点像。我删除了每个与pyinstaller相关的文件。给了它一个全新的开始,

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

https://stackoverflow.com/questions/71550039

复制
相关文章

相似问题

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