Python 2.7 to EXE - 无法安装 pyinstaller



我使用的是Win10,有些代码是用Python 2.7编写的(必须是,它不是我的(,我想创建一个EXE文件。我想安装pyinstaller,但无法安装。我已经尝试更新pip版本,suteuptools,以安装";ez_setup";从pyinstaller网站下载该文件,但没有帮助。

以下是我尝试下载的方式:

pip install pyinstaller
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz
easy_install pyinstaller

这些是我收到的错误:

C:Usersroy.aDesktopworkEMV IL - crypteracryptera 
PythonscriptsActivation python>easy_install pyinstaller
WARNING: The easy_install command is deprecated and will be removed 
in a future version.
Searching for pyinstaller 
Reading https://pypi.org/simple/pyinstaller/
Downloading https://files.pythonhosted.org/packages/b6/27/a006fcadba0db30819c968eb8de 
cb4937cda398ca7a44d8874172cdc228a/pyinstaller-4.3.tar.gz#sha256=5ecf8bbc230d7298a796e52bb745b95eee12878d141f1645612c99246ecd23f2
Best match: pyinstaller 4.3
Processing pyinstaller-4.3.tar.gz
Writing c:usersroy.aappdatalocaltempeasy_install-b2hzrmpyinstaller-4.3setup.cfg
Running pyinstaller-4.3setup.py -q bdist_egg --dist-dir c:usersroy.aappdatalocaltempeasy_install-b2hzrmpyinstaller-4.3egg-dist-tmp-hmqf0j
Traceback (most recent call last):
File "c:python27librunpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:python27librunpy.py", line 72, in _run_code
exec code in run_globals
File "C:Python27Scriptseasy_install.exe__main__.py", line 9, in <module>
File "c:python27libsite-packagessetuptoolscommandeasy_install.py", line 2321, in main
**kw
File "c:python27libsite-packagessetuptools__init__.py", line 162, in setup
return distutils.core.setup(**attrs)
File "c:python27libdistutilscore.py", line 151, in setup
dist.run_commands()
File "c:python27libdistutilsdist.py", line 953, in run_commands
self.run_command(cmd)
File "c:python27libdistutilsdist.py", line 972, in run_command
cmd_obj.run()
File "c:python27libsite-packagessetuptoolscommandeasy_install.py", line 424, in run
self.easy_install(spec, not self.no_deps)
File "c:python27libsite-packagessetuptoolscommandeasy_install.py", line 685, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "c:python27libsite-packagessetuptoolscommandeasy_install.py", line 711, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "c:python27libsite-packagessetuptoolscommandeasy_install.py", line 896, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "c:python27libsite-packagessetuptoolscommandeasy_install.py", line 1164, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "c:python27libsite-packagessetuptoolscommandeasy_install.py", line 1150, in run_setup
run_setup(setup_script, args)
File "c:python27libsite-packagessetuptoolssandbox.py", line 253, in run_setup
raise
File "c:python27libcontextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "c:python27libsite-packagessetuptoolssandbox.py", line 195, in setup_context
yield
File "c:python27libcontextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "c:python27libsite-packagessetuptoolssandbox.py", line 166, in save_modules
saved_exc.resume()
File "c:python27libsite-packagessetuptoolssandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "c:python27libsite-packagessetuptoolssandbox.py", line 154, in save_modules
yield saved
File "c:python27libsite-packagessetuptoolssandbox.py", line 195, in setup_context
yield
File "c:python27libsite-packagessetuptoolssandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "c:python27libsite-packagessetuptoolssandbox.py", line 44, 
in _execfile
code = compile(script, filename, 'exec')
File "c:usersroy.aappdatalocaltempeasy_install- 
b2hzrmpyinstaller-4.3setup.py", line 63
file=sys.stderr)
^
SyntaxError: invalid syntax

这个:

C:Usersroy.aDesktopworkEMV IL - crypteracryptera PythonscriptsActivation python>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:python27python.exe' 'c:python27libsite-packagespip_vendorpep517_in_process.py' get_requires_for_build_wheel 'c:usersroy.aappdatalocaltemptmpqtblxb'
cwd: c:usersroy.aappdatalocaltemppip-install-wcrcpkpyinstaller
Complete output (19 lines):
Traceback (most recent call last):
File "c:python27libsite-packagespip_vendorpep517_in_process.py", line 280, in <module>
main()
File "c:python27libsite-packagespip_vendorpep517_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "c:python27libsite-packagespip_vendorpep517_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "c:usersroy.aappdatalocaltemppip-build-env-blngutoverlayLibsite-packagessetuptoolsbuild_meta.py", line 146, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "c:usersroy.aappdatalocaltemppip-build-env-blngutoverlayLibsite-packagessetuptoolsbuild_meta.py", line 127, in _get_build_requires
self.run_setup()
File "c:usersroy.aappdatalocaltemppip-build-env-blngutoverlayLibsite-packagessetuptoolsbuild_meta.py", line 243, in run_setup
self).run_setup(setup_script=setup_script)
File "c:usersroy.aappdatalocaltemppip-build-env-blngutoverlayLibsite-packagessetuptoolsbuild_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:python27python.exe' 'c:python27libsite-packagespip_vendorpep517_in_process.py' get_requires_for_build_wheel 'c:usersroy.aappdatalocaltemptmpqtblxb' Check the logs for full command output.

任何帮助都将不胜感激感谢

PyInstaller的变更日志说明Python 2.7已被删除,因此您必须安装与2.7兼容的旧版本。

尝试使用pip install pyinstaller==3.6安装旧版本。

您可能需要对所需的其他第三方模块执行类似操作。

最新更新