简体   繁体   English

无法正确安装 discord 模块

[英]cannot instal discord module properly

while installing the module, i get this error在安装模块时,我收到此错误

C:\Users\User\Desktop\Trial>pip install discordpy
Collecting discordpy
  Using cached discordpy-0.1.1.tar.gz (1.3 kB)
Using legacy 'setup.py install' for discordpy, since package 'wheel' is not installed.
Installing collected packages: discordpy
    Running setup.py install for discordpy ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\user\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-ogovpl6m\\discordpy_7005c477f7d447de9f394c1c31fd29bc\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-ogovpl6m\\discordpy_7005c477f7d447de9f394c1c31fd29bc\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\User\AppData\Local\Temp\pip-record-t2eexxn7\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\appdata\local\programs\python\python38-32\Include\discordpy'
         cwd: C:\Users\User\AppData\Local\Temp\pip-install-ogovpl6m\discordpy_7005c477f7d447de9f394c1c31fd29bc\
    Complete output (14 lines):
    running install
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\User\AppData\Local\Temp\pip-install-ogovpl6m\discordpy_7005c477f7d447de9f394c1c31fd29bc\setup.py", line 32, in <module>
        setup(
      File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "c:\users\user\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\User\AppData\Local\Temp\pip-install-ogovpl6m\discordpy_7005c477f7d447de9f394c1c31fd29bc\setup.py", line 20, in run
        raise Exception("You probably meant to install and run discord-py")
    Exception: You probably meant to install and run discord-py
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\user\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-ogovpl6m\\discordpy_7005c477f7d447de9f394c1c31fd29bc\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-ogovpl6m\\discordpy_7005c477f7d447de9f394c1c31fd29bc\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\User\AppData\Local\Temp\pip-record-t2eexxn7\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\appdata\local\programs\python\python38-32\Include\discordpy' Check the logs for full command output.

and to double check when i try running with this code-并在我尝试使用此代码运行时仔细检查-

from discord.ext import commands
code=commands.Bot(command_prefix='*')
@client.event
async def when_ready():
    print("Bot is ready")
@client.command()
async def hello(abcd):
    await abcd.send("Hi")
client.run('the bot token, cant share') 

the error was shown to me was this向我显示的错误是这个

  File "C:\Users\User\Desktop\Trial\bot.py", line 4, in <module>
    @client.event
NameError: name 'client' is not defined

pls help out, so i need to spam so that my question get subbmitted and i dont get a error regarding that your post is mostly code, please add some more details?请帮忙,所以我需要发送垃圾邮件以便提交我的问题,并且我没有收到关于您的帖子主要是代码的错误,请添加更多详细信息?

  1. its discord.py so pip install -U discord.py它的discord.py所以pip install -U discord.py
  2. You use whatever you define Client or Bot to, so it will be @code.event , @code.command() and so您可以使用您定义ClientBot的任何内容,因此它将是@code.event@code.command()等等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM