我的目标是创建一个Python脚本的独立可执行文件以进行分发。该文件是一个Python脚本,代码中有多个库导入。我使用Python 3.6。
我还没有成功使用py2exe,但我被告知pyinstaller是必要的,因为py2exe不能处理所有事情。但是,pyinstaller只与Python 2.x兼容,但您可以使用pip3在Python 3.x上安装。
我运行了以下内容:
pip3.6安装pyinstaller
并收到下面的堆栈跟踪。 PIP显示库已安装,但尝试执行pyinstaller或导入它失败。我该如何前进?是否有更好的解决方案允许某人在没有安装Python的情况下运行Python脚本?
Exception:
Traceback (most recent call last):
File "c:\program files\python36\lib\site-packages\pip\basecommand.py", line 21
5, in main
status = self.run(options, args)
File "c:\program files\python36\lib\site-packages\pip\commands\install.py", li
ne 317, in run
prefix=options.prefix_path,
File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 74
2, in install
**kwargs
File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", lin
e 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", lin
e 1032, in move_wheel_files
isolated=self.isolated,
File "c:\program files\python36\lib\site-packages\pip\wheel.py", line 493, in
move_wheel_files
maker.make_multiple(['%s = %s' % kv for kv in console.items()])
File "c:\program files\python36\lib\site-packages\pip\_vendor\distlib\scripts.
py", line 383, in make_multiple
filenames.extend(self.make(specification, options))
File "c:\program files\python36\lib\site-packages\pip\_vendor\distlib\scripts.
py", line 372, in make
self._make_script(entry, filenames, options=options)
File "c:\program files\python36\lib\site-packages\pip\_vendor\distlib\scripts.
py", line 276, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "c:\program files\python36\lib\site-packages\pip\_vendor\distlib\scripts.
py", line 212, in _write_script
launcher = self._get_launcher('t')
File "c:\program files\python36\lib\site-packages\pip\_vendor\distlib\scripts.
py", line 351, in _get_launcher
result = finder(distlib_package).find(name).bytes
File "c:\program files\python36\lib\site-packages\pip\_vendor\distlib\resource
s.py", line 324, in finder
raise DistlibException('Unable to locate finder for %r' % package)
pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.d
istlib'