我正在尝试通过pyinstaller将py转换为exe,但是它会响应错误消息。
谢谢!
我在下面输入的内容
PS E:\Python\Scripts> pyinstaller.exe --onefile d:\Python Projects\Concept Number Generator\Concept Number Generator.py
响应是什么
71 INFO: PyInstaller: 3.6
71 INFO: Python: 3.8.1
72 INFO: Platform: Windows-10-10.0.17763-SP0
73 INFO: wrote E:\Python\Scripts\Python.spec
77 INFO: UPX is not available.
Traceback (most recent call last):
File "e:\python\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "e:\python\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "E:\Python\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "e:\python\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "e:\python\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "e:\python\lib\site-packages\PyInstaller\building\build_main.py", line 734, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "e:\python\lib\site-packages\PyInstaller\building\build_main.py", line 681, in build
exec(code, spec_namespace)
File "E:\Python\Scripts\Python.spec", line 6, in <module>
a = Analysis(['d:\\Python', 'Projects\\Concept', 'Number', 'Generator\\Concept', 'Number', 'Generator.py'],
File "e:\python\lib\site-packages\PyInstaller\building\build_main.py", line 191, in __init__
raise ValueError("script '%s' not found" % script)
ValueError: script 'd:\Python' not found
答案 0 :(得分:1)
如评论中所述,当您在不带引号的情况下输入时,它会将它们解释为单独的参数,因此会导致给定的错误。
只需将它们封装在引号内
pyinstaller.exe --onefile "d:\Python Projects\Concept Number Generator"\"Concept Number Generator.py"
这应该可以解决问题。