我尝试了很多不同的东西,现在我不确定。也许有一些兼容性错误。fbs 教程说它适用于 3.6 v 的 python,并且可以在 3.7 上处理错误。但是当我使用 3.6 v 的 python 时,PySide2 的导入失败。尝试了 5.12.0、5.12.5、5.13.2 版本的 PySide2 与 shiboken2 相同。我所拥有的一切都是一样的:
File "C:\Users\test\fbsenv\program_folder\lib\site-packages\shiboken2\__init__.py", line 27, in <module>
from .shiboken2 import *
ImportError: DLL load failed: The specified procedure could not be found.
无论是否在 venv 中,在 Windows 7(x64) 的不同系统上。使用 3.7 v 的 python 它可以工作,但我无法冻结我的项目。任何项目,即使是新的空项目,都会失败(片段中的文本用作剧透)
(fbsenv) F:\Programming>fbs freeze
Traceback (most recent call last):
File "F:\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_a
s_main
"__main__", mod_spec)
File "F:\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "F:\Programming\fbsenv\Scripts\pyinstaller.exe\__main__.py", line 9, in <
module>
File "f:\programming\fbsenv\lib\site-packages\PyInstaller\__main__.py", line 1
11, in run
run_build(pyi_config, spec_file, **vars(args))
File "f:\programming\fbsenv\lib\site-packages\PyInstaller\__main__.py", line 6
3, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "f:\programming\fbsenv\lib\site-packages\PyInstaller\building\build_main.
py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "f:\programming\fbsenv\lib\site-packages\PyInstaller\building\build_main.
py", line 784, in build
exec(text, spec_namespace)
File "<string>", line 29, in <module>
File "f:\programming\fbsenv\lib\site-packages\PyInstaller\building\api.py", li
ne 424, in __init__
strip_binaries=self.strip, upx_binaries=self.upx,
File "f:\programming\fbsenv\lib\site-packages\PyInstaller\building\api.py", li
ne 196, in __init__
self.__postinit__()
File "f:\programming\fbsenv\lib\site-packages\PyInstaller\building\datastruct.
py", line 158, in __postinit__
self.assemble()
File "f:\programming\fbsenv\lib\site-packages\PyInstaller\building\api.py", li
ne 273, in assemble
pylib_name = os.path.basename(bindepend.get_python_library_path())
File "F:\Programs\Python\Python37-32\lib\ntpath.py", line 214, in basename
return split(p)[1]
File "F:\Programs\Python\Python37-32\lib\ntpath.py", line 183, in split
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Traceback (most recent call last):
File "F:\Programming\fbsenv\Scripts\fbs-script.py", line 11, in <module>
load_entry_point('fbs==0.8.4', 'console_scripts', 'fbs')()
File "f:\programming\fbsenv\lib\site-packages\fbs\__main__.py", line 17, in _m
ain
fbs.cmdline.main()
File "f:\programming\fbsenv\lib\site-packages\fbs\cmdline.py", line 32, in mai
n
fn(*args)
File "f:\programming\fbsenv\lib\site-packages\fbs\builtin_commands\__init__.py
", line 120, in freeze
freeze_windows(debug=debug)
File "f:\programming\fbsenv\lib\site-packages\fbs\freeze\windows.py", line 18,
in freeze_windows
run_pyinstaller(args, debug)
File "f:\programming\fbsenv\lib\site-packages\fbs\freeze\__init__.py", line 47
, in run_pyinstaller
run(args, check=True)
File "F:\Programs\Python\Python37-32\lib\subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pyinstaller', '--name', 'Namer', '--no
upx', '--log-level', 'ERROR', '--noconfirm', '--windowed', '--icon', 'F:\\Progra
mming\\src\\main\\icons\\Icon.ico', '--distpath', 'F:\\Programming\\target', '--
specpath', 'F:\\Programming\\target\\PyInstaller', '--workpath', 'F:\\Programmin
g\\target\\PyInstaller', '--additional-hooks-dir', 'f:\\programming\\fbsenv\\lib
\\site-packages\\fbs\\freeze\\hooks', '--runtime-hook', 'F:\\Programming\\target
\\PyInstaller\\fbs_pyinstaller_hook.py', 'F:\\Programming\\src\\main\\python\\ma
in.py']' returned non-zero exit status 1.
在“F:\Programs\Python\Python37-32\lib\subprocess.py”中,第 487 行有
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired:
process.kill()
stdout, stderr = process.communicate()
raise TimeoutExpired(process.args, timeout, output=stdout,
stderr=stderr)
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
return CompletedProcess(process.args, retcode, stdout, stderr)
第二次加注在这个区块中被跟注,我不知道为什么。所以也许我使用了错误的版本?为什么 shiboken2 不能在 3.6 上运行?许多人说,泰国 fbs 将与 PySide 一起工作(它运行,但不会冻结),但也许我应该使用 PyQt?