找不到PyInstaller脚本错误

时间:2016-10-15 12:04:28

标签: python pyinstaller

我为一个应用程序创建了一个脚本并且它运行良好,现在我尝试使用PyInstaller将其执行到.app。我正在运行最新的mac os版本。似乎PyInstaller无法找到我的脚本,但它拼写正确并且它确实存在。这就是我得到的:

Air-Andrej:~ Andrey$ pyinstaller -F --onefile bb.py
110 INFO: PyInstaller: 3.2
110 INFO: Python: 3.5.1
122 INFO: Platform: Darwin-15.6.0-x86_64-i386-64bit
124 INFO: wrote /Users/Andrey/bb.spec
127 INFO: UPX is not available.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/bin/pyinstaller", line 11, in <module>
    sys.exit(run())
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyInstaller/__main__.py", line 90, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyInstaller/__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 788, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 734, in build
    exec(text, spec_namespace)
  File "<string>", line 16, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 162, in __init__
    raise ValueError("script '%s' not found" % script)
ValueError: script '/Users/Andrey/bb.py' not found

3 个答案:

答案 0 :(得分:1)

我只是想通了。我希望将整个目录放入,这意味着计算机试图在错误的目录中找到该文件,或者只是在某一点停止。

答案 1 :(得分:0)

Air-Andrej:~ Andrey$ pyinstaller -F --onefile bb.py

重命名您的.py文件 删除文件名之间的空格 在onefile和bb.py

之间
Air-Andrej:~ Andrey$ pyinstaller -F --onefilebb.py

它应该看起来像这样

答案 2 :(得分:0)

pyinstaller -F --onefile bb 

删除.py扩展名是因为尽管您具有python脚本,但是从文本编辑器中保存它时,不会将.py附加到文件中。奇迹般有效。