简体   繁体   中英

PyInstaller Script Not found Error

I made a script for an app and it works perfectly, and now I'm trying to use PyInstaller to execute it into an .app. I'm running the latest mac os version. It seems like PyInstaller can't find my script but it's spelled correctly and it actually exists. This is what I get:

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

I just figured it out. It was expecting me to put the whole directory in, so that means that the computer was trying to find the file in the wrong directory or just stopped at a certain point.

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

Rename you .py file remove the space between your file name that is between the onefile and bb.py

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

it should look like this

pyinstaller -F --onefile bb 

Remove the .py extension because although you have a python script, when you save it from a text editor it does not append the .py to your file. Works like a charm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM