在 Python 2.7 中安装包时 Pip 返回语法错误
Pip returning syntax error when installing package in Python 2.7
我正在尝试在 Wine 中安装一个 Python 包,但它一直给我内部语法错误。当我尝试安装 pyinstaller 时,它给了我这个:
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 卸载和重新安装,但总是出现同样的错误。
我正在使用 Python 2.7.18 和 Wine 4.0。谁能告诉我如何解决这个问题?
据我从 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 版。
祝你好运!
- 获取 python 的更新版本。你的版本太旧了
- 最近我遇到了这个问题,不像你的,但有点像。我删除了与 pyinstaller 相关的每个文件。重新开始
如果 Python 2.7 绝对需要使用,使用最后支持的版本应该仍然有效。请尝试
pip install pyinstaller==3.6
另请参阅:How do you downgrade pyinstaller using pip?
我正在尝试在 Wine 中安装一个 Python 包,但它一直给我内部语法错误。当我尝试安装 pyinstaller 时,它给了我这个:
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 卸载和重新安装,但总是出现同样的错误。
我正在使用 Python 2.7.18 和 Wine 4.0。谁能告诉我如何解决这个问题?
据我从 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 版。
祝你好运!
- 获取 python 的更新版本。你的版本太旧了
- 最近我遇到了这个问题,不像你的,但有点像。我删除了与 pyinstaller 相关的每个文件。重新开始
如果 Python 2.7 绝对需要使用,使用最后支持的版本应该仍然有效。请尝试
pip install pyinstaller==3.6
另请参阅:How do you downgrade pyinstaller using pip?