I have a script that needs moviepy, I wanted to have it as an executable but that doesn't seem to work, does anyone know if there is a workaround for this?
from moviepy.editor import *
Console:
./run
Traceback (most recent call last):
File "run.py", line 21, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
File "moviepy/editor.py", line 87, in <module>
File "<string>", line 1, in <module>
AttributeError: module 'moviepy.audio.fx.all' has no attribute 'audio_fadein'
[75721] Failed to execute script 'run' due to unhandled exception!
First create a virtual environment using venv.
Then create a requirements file, if you haven't done already.
pip freeze > requirements.txt
Use this requirements file in your pyinstaller, while creating executable.
path\to\pyinstaller.exe --onefile --paths \venv_location\file.py
You can go through PyInstaller Docs for more details.
Ok I got it to run, but it's not pretty ️
If someone has a better solution please write
My folder structure now looks like this:
.
+-- exe.exe
+-- .script
+-- run.py
in exe.exe is only that:
from subprocess import call
call(["python3", ".script/run.py"])
The main point was to start the script without terminal, and that works
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.