Python 未找到Discord.py音乐bot-ffmpeg

Python 未找到Discord.py音乐bot-ffmpeg,python,pycharm,discord,discord.py,Python,Pycharm,Discord,Discord.py,我一直试图解决一个问题,同时创建一个音乐命令与不和谐的py。除了一个命令外,每个命令都很有效。当我尝试使用play命令时,会出现以下错误: 错误: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found. 代码(仅包括play命令,其他命令与本主题相关,并且工作正常): 好的,经过一番搜索,我终于发现重新启动计算机应该可以

我一直试图解决一个问题,同时创建一个音乐命令与不和谐的py。除了一个命令外,每个命令都很有效。当我尝试使用play命令时,会出现以下错误:

错误:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.
代码(仅包括play命令,其他命令与本主题相关,并且工作正常):


好的,经过一番搜索,我终于发现重新启动计算机应该可以解决这个问题,它成功了。对于其他有同样问题的人,我推荐这段视频:

import discord
from discord.ext import commands, tasks
from discord.voice_client import VoiceClient
import youtube_dl
import random

youtube_dl.utils.bug_reports_message = lambda: ''

ytdl_format_options = {
    'format': 'bestaudio/best',
    'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
    'restrictfilenames': True,
    'noplaylist': True,
    'nocheckcertificate': True,
    'ignoreerrors': False,
    'logtostderr': False,
    'quiet': True,
    'no_warnings': True,
    'default_search': 'auto',
    'source_address': '0.0.0.0' 
}

ffmpeg_options = {
    'options': '-vn'
}

ytdl = youtube_dl.YoutubeDL(ytdl_format_options)


class YTDLSource(discord.PCMVolumeTransformer):
    def __init__(self, source, *, data, volume=0.5):
        super().__init__(source, volume)

        self.data = data

        self.title = data.get('title')
        self.url = data.get('url')

    @classmethod
    async def from_url(cls, url, *, loop=None, stream=False):
        loop = loop or asyncio.get_event_loop()
        data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))

        if 'entries' in data:
            data = data['entries'][0]

        filename = data['url'] if stream else ytdl.prepare_filename(data)
        return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)


status = ['Jamming!', 'Eating!', 'Sleeping!']
queue = []


@bot.command(name='gplay', help='Playing the song.')
async def gplay(ctx):
    global queue
    server = ctx.message.guild
    voice_channel = server.voice_client
    async with ctx.typing():
        player = await YTDLSource.from_url(queue[0], loop=bot.loop)
        voice_channel.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
    await ctx.send('**Now playing** {}'.format(player.title))
    del (queue[0])