Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将py转换为exe时出现Python pyinstaller错误_Python_Pyinstaller - Fatal编程技术网

将py转换为exe时出现Python pyinstaller错误

将py转换为exe时出现Python pyinstaller错误,python,pyinstaller,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

我正试图通过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
71信息:PyInstaller:3.6
71信息:Python:3.8.1
72信息:平台:Windows-10-10.0.17763-SP0
73信息:编写了E:\Python\Scripts\Python.spec
77信息:UPX不可用。
回溯(最近一次呼叫最后一次):
文件“e:\python\lib\runpy.py”,第193行,在作为主模块的运行模块中
返回运行代码(代码、主全局、无、,
文件“e:\python\lib\runpy.py”,第86行,在运行代码中
exec(代码、运行\全局)
文件“E:\Python\Scripts\pyinstaller.exe\\uuuuu main\uuuuuu.py”,第9行,在
文件“e:\python\lib\site packages\PyInstaller\\uuuuu main\uuuuuu.py”,第114行,正在运行
运行构建(pyi\u配置,规范文件,**vars(args))
文件“e:\python\lib\site packages\PyInstaller\\uuuuu main\uuuuuu.py”,第65行,在run\u build中
PyInstaller.building.build\u main.main(pyi\u配置,spec\u文件,**kwargs)
文件“e:\python\lib\site packages\PyInstaller\building\build\u main.py”,第734行,在main中
构建(specfile,kw.get('distpath'),kw.get('workpath'),kw.get('clean_build'))
文件“e:\python\lib\site packages\PyInstaller\building\building\u main.py”,第681行,内部版本
exec(代码、规范和命名空间)
文件“E:\Python\Scripts\Python.spec”,第6行,在
a=分析(['d:\\Python','Projects\\Concept','Number','Generator\\Concept','Number','Generator.py'],
文件“e:\python\lib\site packages\PyInstaller\building\build\u main.py”,第191行,在\uuu init中__
raise VALUERROR(“未找到脚本“%s”%script)
ValueError:找不到脚本“d:\Python”

如注释中所述,如果输入时没有引号,则会将其解释为单个参数,因此会导致给定错误

只需将它们封装在引号内即可

pyinstaller.exe --onefile "d:\Python Projects\Concept Number Generator"\"Concept Number Generator.py"

这应该可以解决问题。

您需要在引号中写出带空格的路径。现在,该路径被解释为多个单独的参数。
pyinstaller.exe--onefile“d:\Python Projects\Concept number Generator”\“Concept number Generator.py”
谢谢!我看了一个Youtube上的家伙给我看,没有报价,所以我手动删除了。太傻了。。