Windows7 64位系统下Python MoviePy运行报错[WinError 193]求助
Hey there, let's work through this frustrating WinError 193 issue you're hitting. This error almost always boils down to a 32-bit/64-bit compatibility mismatch in your setup, so let's break down the most effective fixes step by step:
1. Verify Your FFmpeg is 64-bit
That error often pops up if you're using a 32-bit FFmpeg binary with your 64-bit Python/MoviePy setup:
- Double-check that you downloaded the 64-bit Windows build of FFmpeg (not the 32-bit one). Head to the official FFmpeg site to grab the correct version—look for builds labeled "win64".
- After extracting the FFmpeg folder, make sure the
bindirectory (containingffmpeg.exe,ffplay.exe,ffprobe.exe) is added to your system'sPATHenvironment variable. Alternatively, you can manually point MoviePy to the correct binary in your code:
(Use a raw stringfrom moviepy.config import change_settings change_settings({"FFMPEG_BINARY": r"C:\full\path\to\your\64bit\ffmpeg.exe"})r""or double backslashes\\in the path to avoid escape character issues.)
2. Confirm Your Python Installation is 64-bit
It's easy to accidentally install 32-bit Python even on a 64-bit system. To check:
- Open Command Prompt and run:
If the output ispython -c "import sys; print(sys.maxsize > 2**32)"True, you're on 64-bit Python (good). If it'sFalse, you'll need to uninstall the 32-bit Python and reinstall the 64-bit version from the official Python site.
3. Reinstall MoviePy with 64-bit Python
If you had a 32-bit Python before switching, residual 32-bit MoviePy files might be causing issues:
- Uninstall the current MoviePy:
pip uninstall moviepy -y - Reinstall it using your 64-bit Python's pip (use
pip3or specify your Python path if you have multiple versions, e.g.,py -3.11 -m pip install moviepy).
4. Check Imagemagick's Bit Version
Even though you have Imagemagick installed, ensure it's the 64-bit variant. You can point MoviePy to its binary explicitly too:
change_settings({"IMAGEMAGICK_BINARY": r"C:\path\to\64bit\ImageMagick\convert.exe"})
Final Tip
After making any changes to environment variables or paths, restart your command prompt/IDE to ensure the changes take effect—this is often overlooked but crucial!
内容的提问来源于stack exchange,提问作者Vova

