Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'moviepy.editor' #123

Open
unsiao opened this issue Nov 22, 2024 · 1 comment
Open

No module named 'moviepy.editor' #123

unsiao opened this issue Nov 22, 2024 · 1 comment

Comments

@unsiao
Copy link

unsiao commented Nov 22, 2024

Windows11x64 Python Version 3.12.7

启动错误:

Python已经有 moviepy扩展了 但是仍无法启动 提示未没有该模块

(funclip) C:\NEX\FunClip>python funclip/launch.py
Key Conformer already exists in model_classes, re-register
<unknown>:65: SyntaxWarning: invalid escape sequence '\['
<unknown>:124: SyntaxWarning: invalid escape sequence '\['
<unknown>:135: SyntaxWarning: invalid escape sequence '\['
<unknown>:256: SyntaxWarning: invalid escape sequence '\['
<unknown>:277: SyntaxWarning: invalid escape sequence '\['
<unknown>:300: SyntaxWarning: invalid escape sequence '\['
Key Linear already exists in adaptor_classes, re-register
Key TransformerDecoder already exists in decoder_classes, re-register
Key LightweightConvolutionTransformerDecoder already exists in decoder_classes, re-register
Key LightweightConvolution2DTransformerDecoder already exists in decoder_classes, re-register
Key DynamicConvolutionTransformerDecoder already exists in decoder_classes, re-register
Key DynamicConvolution2DTransformerDecoder already exists in decoder_classes, re-register
Traceback (most recent call last):
  File "C:\NEX\FunClip\funclip\launch.py", line 12, in <module>
    from videoclipper import VideoClipper
  File "C:\NEX\FunClip\funclip\videoclipper.py", line 15, in <module>
    from moviepy.editor import *
ModuleNotFoundError: No module named 'moviepy.editor'

全部日志:

(funclip) C:\NEX\FunClip>python --version
Python 3.12.7

(funclip) C:\NEX\FunClip>pip install moviepy
Requirement already satisfied: moviepy in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (2.0.0)
Requirement already satisfied: decorator<6.0,>=4.0.2 in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from moviepy) (5.1.1)
Requirement already satisfied: imageio<3.0,>=2.5 in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from moviepy) (2.36.0)
Requirement already satisfied: imageio-ffmpeg>=0.2.0 in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from moviepy) (0.5.1)
Requirement already satisfied: numpy>=1.25.0 in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from moviepy) (1.26.4)
Requirement already satisfied: proglog<=1.0.0 in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from moviepy) (0.1.10)
Requirement already satisfied: python-dotenv>=0.10 in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from moviepy) (1.0.1)
Requirement already satisfied: pillow<11.0,>=9.2.0 in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from moviepy) (10.4.0)
Requirement already satisfied: setuptools in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from imageio-ffmpeg>=0.2.0->moviepy) (75.1.0)
Requirement already satisfied: tqdm in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from proglog<=1.0.0->moviepy) (4.67.0)
Requirement already satisfied: colorama in c:\users\unsiao\anaconda3\envs\funclip\lib\site-packages (from tqdm->proglog<=1.0.0->moviepy) (0.4.6)

(funclip) C:\NEX\FunClip>python funclip/launch.py
Key Conformer already exists in model_classes, re-register
<unknown>:65: SyntaxWarning: invalid escape sequence '\['
<unknown>:124: SyntaxWarning: invalid escape sequence '\['
<unknown>:135: SyntaxWarning: invalid escape sequence '\['
<unknown>:256: SyntaxWarning: invalid escape sequence '\['
<unknown>:277: SyntaxWarning: invalid escape sequence '\['
<unknown>:300: SyntaxWarning: invalid escape sequence '\['
Key Linear already exists in adaptor_classes, re-register
Key TransformerDecoder already exists in decoder_classes, re-register
Key LightweightConvolutionTransformerDecoder already exists in decoder_classes, re-register
Key LightweightConvolution2DTransformerDecoder already exists in decoder_classes, re-register
Key DynamicConvolutionTransformerDecoder already exists in decoder_classes, re-register
Key DynamicConvolution2DTransformerDecoder already exists in decoder_classes, re-register
Traceback (most recent call last):
  File "C:\NEX\FunClip\funclip\launch.py", line 12, in <module>
    from videoclipper import VideoClipper
  File "C:\NEX\FunClip\funclip\videoclipper.py", line 15, in <module>
    from moviepy.editor import *
ModuleNotFoundError: No module named 'moviepy.editor'

(funclip) C:\NEX\FunClip>
@hanmusu
Copy link

hanmusu commented Nov 25, 2024

  1. 降级 moviepy 版本: 如果您需要使用 moviepy.editor 模块,可以尝试降级到一个更早的版本,例如 1.0.3,这个版本通常包含 editor 模块:pip install moviepy==1.0.3
    bash
  2. 修改代码: 如果您不想降级 moviepy,可以尝试修改您的代码,避免使用 moviepy.editor。例如,可以直接从 moviepy 导入所需的类和函数:from moviepy.video.io.VideoFileClip import VideoFileClip
    from moviepy.video.fx.all import resize
    python示例代码假设您原来使用的是 moviepy.editor 模块来加载视频文件并调整大小,可以改为如下方式:from moviepy.video.io.VideoFileClip import VideoFileClip
    from moviepy.video.fx.all import resize

加载视频文件

video = VideoFileClip("my_video.mp4")

调整视频大小

resized_video = video.fx(resize, width=800)

输出视频

resized_video.write_videofile("output.mp4")

上面是ai助手给的建议,第一种我试了,程序能跑起来,第二种没能力试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants