我用python2.7.18輪更新,pip也是。但我仍然得到同樣的錯誤。在相同版本的 linux python 上但在 windows 上會出錯。我該如何解決這個錯誤?
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.
uj5u.com熱心網友回復:
在 python3 中,有很多不同的更改可能會使 pyinstaller 上的較新版本無法在 python2 上運行。為了解決此問題,您必須執行以下任一操作:
- 安裝 Python3 或
- 安裝支持 python 2.7 的特定 pyinstaller 版本,最新版本是 3.6。
pip install pyinstaller==3.6
我也強烈建議不要使用 python 2,因為它已經到了生命的盡頭,大多數人使用 python 3。對于少數使用 python 2 的人,他們這樣做是因為他們很好奇,想要運行一些舊代碼,或者將舊程式移植到 python 3 中。(如果你想為 python3 安裝 pyinstaller 并且你已經安裝了兩個 python 版本)
pip3 install pyinstaller
這將告訴程式您使用的是 python 3 的 pip 而不是 python 2 的。我希望這有幫助!
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/448696.html
標籤:Python python-2.7 点子 安装程序
