Moviepy OSError Exec 格式错误 - 缺少 Shebang? [英] Moviepy OSError Exec format error - Missing Shebang?

查看:81
本文介绍了Moviepy OSError Exec 格式错误 - 缺少 Shebang?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Raspian 上使用带有 Python 3.2.3 的 MoviePy.我已经安装了它(适用于 Python 2.7、3.2 和 3.5……长话短说)和线路

I am attempting to use MoviePy with Python 3.2.3 on Raspian. I have installed it (for Python 2.7, 3.2 and 3.5... long story) and the line

from moviepy.editor import *

工作正常.当我尝试

clip = VideoFileClip("vid.mov")

这是最基本的命令,它给出了错误

which is the most basic command, it gives the error

Traceback (most recent call last):
File "/home/pi/QuickFlicsPics/moviepytest.py", line 8, in <module>
  clip = VideoFileClip("vid.mov")
File "/usr/local/lib/python3.2/distpackages/moviepy/video/io/VideoFileClip.py", line 55, in __init__
  reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt)
File "/usr/local/lib/python3.2/dist-packages/moviepy/video/io/ffmpeg_reader.py", line 32, in __init__
   infos = ffmpeg_parse_infos(filename, print_infos, check_duration)
File "/usr/local/lib/python3.2/dist-packages/moviepy/video/io/ffmpeg_reader.py", line 237, in ffmpeg_parse_infos
  proc = sp.Popen(cmd, **popen_params)
File "/usr/lib/python3.2/subprocess.py", line 745, in __init__
  restore_signals, start_new_session)
File "/usr/lib/python3.2/subprocess.py", line 1371, in _execute_child
  raise child_exception_type(errno_num, err_msg)

OSError: [Errno 8] Exec format error

我研究了这个错误,它似乎与某处缺少 shebang 线有关.这是正确的,如果是这样,我该如何找到它丢失的地方,我要添加什么?谢谢

I have researched this error, and it appears to be something to do with a shebang line missing somewhere. Is this correct, if so, how do I go about finding where it is missing, and what do I add? Thanks

根据 cxw 的评论,我使用命令安装了 moviepy

As per cxw's comment, I installed moviepy using the command

pip-3.2 install moviepy

(我可能也用过 'sudo')

(I may have used 'sudo' as well)

我第一次使用moviepy时应该会自动下载FFMPEG:

FFMPEG was supposed to download automatically when I first used moviepy:

MoviePy 依赖于软件 FFMPEG 进行视频读写.> 您无需担心,因为 FFMPEG 应该会在您第一次使用 MoviePy 时由 ImageIO 自动下载/安装(需要几秒钟).如果要使用特定版本的 FFMPEG,请按照文件 config_defaults.py 中的说明进行操作.

MoviePy depends on the software FFMPEG for video reading and writing. > You don’t need to worry about that, as FFMPEG should be automatically > downloaded/installed by ImageIO during your first use of MoviePy (it takes a few seconds). If you want to use a specific version of FFMPEG, follow the instructions in file config_defaults.py.

[引用自安装指南 此处]

推荐答案

手动下载 ffmpeg,然后在运行 Python 代码之前,执行

Manually download ffmpeg, then before running your Python code, do

export FFMPEG_BINARY=path/to/ffmpeg

在 shell/终端提示符处.

at the shell/terminal prompt.

据我所知 来源,ffmpeg的自动下载不知道树莓派.自动下载代码imageio github repo,它只知道linux32"与linux64"".看起来它没有 ARM-linux 选项.当 ARM 内核看到非 ARM 映像时,它会抛出您看到的错误.

As far as I can tell from the source, the automatic download of ffmpeg does not know about Raspberry Pis. The auto-download code pulls from the imageio github repo, which only knows "linux32" vs. "linux64". It doesn't look like it has an ARM-linux option. When the ARM kernel sees a non-ARM image, it throws the error you see.

您可以编辑您的电影而不是使用环境变量 config-defaults.py 文件指定FFMPEG_BINARY = r"/path/to/ffmpeg".

Rather than using the environment variable, you can edit your moviepy config-defaults.py file to specify FFMPEG_BINARY = r"/path/to/ffmpeg".

编辑找到path/to/ffmpeg安装后用apt-get,做

dpkg -L ffmpeg | grep bin

在 shell/终端提示符下.它可能在 /bin/usr/bin 中,并且可能被称为 ffmpegffmpeg-x.xx(带有一些版本号).
感谢 这个答案 dpkg

at the shell/terminal prompt. It will probably be in /bin or /usr/bin, and will probably be called ffmpeg or ffmpeg-x.xx (with some version number).
Thanks to this answer for dpkg

这篇关于Moviepy OSError Exec 格式错误 - 缺少 Shebang?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆