python - 将py转换为exe时出现Python pyinstaller错误
问题描述
我正在尝试通过 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
解决方案
正如评论中提到的,当您在没有引号的情况下输入它时,它会将它们解释为单独的参数,因此这会导致给定的错误。
只需将它们封装在引号内
pyinstaller.exe --onefile "d:\Python Projects\Concept Number Generator"\"Concept Number Generator.py"
这应该可以解决问题。
推荐阅读
- scala - 性能:Vector vs ArrayBuffer vs Array
- android - 分页 3 - IllegalArgumentException:前置状态完成后的附加前置事件
- java - Spring数据存储库按列分组,包含其他列的对象列表
- python-3.x - 试验 AES-128 对称密钥密码。使用 python
- javascript - Javascript asyn/await 未按预期运行
- mysql - Mysql 读取解析在 cli 中给出空白字符
- python - 尝试访问 networkx 中的节点属性时出现“keyerror”
- c# - 使用 ShowDialog 时拥有一个新表单实例还是每次显示表单时都创建一个新表单更好?- C#
- ruby-on-rails - Rails & simple_form // 没有路线匹配 [PATCH] "/spots.10"
- c# - C# 在 JSON 文件中将 db null 值视为空