如何安装discord.py rewrite?

How to install discord.py rewrite?

我 运行 python3 -m pip install -U discord.py 但它只安装了 discord.py v0.16.x。如何安装新的 discord.py rewrite v1.0?

我使用 pip uninstall discord.py 卸载了旧的 discord.py 并重新 运行 pip 安装 discord.py,只是为了再次获得版本 v0.16.x新的 v1.0 版本。

尝试使用

pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]

应该转到 discord.py 存储库的 rewrite 分支并获取要安装的 egg 文件。

如果您还有问题,可以使用:

python3 -m pip install -U https://github.com/Rapptz/discord.py/archive/rewrite.zip#egg=discord.py[voice]

打开命令提示符并输入;

pip install discord.py

或;

pip install discord.py==1.0.1

然后如果你想要语音;

pip install discord.py[voice]

如果您想升级到最新版本,您可以使用:

pip install discord.py --upgrade

简单,打开命令提示符并输入 "pip install discord.py" 如果你这样做,你很可能会想要 "pip install requests" 如果 pip 命令不起作用,请打开 python 安装程序并确保单击添加到环境变量选项! 这就是你的全部好去处! 使用 Visual Studio 代码或 Atom,它们是迄今为止我用于我的机器人的最好的!

尝试:

pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]

或者:

python -m pip install discord.py

如果你正在使用 PyCharm 我认为你应该使用第二个

我相信discord.pyrewrite是根据其正式网站信息正式发布的。

这样,安装模块的命令就变得很简单了。

pip install discord.py

如果您想安装特定版本。 (此时最新的是1.3.4)

pip install discord.py==1.3.4

如果您遇到 cmd 无法识别您的 pip 命令的 pip 问题,请执行以下操作:

py -3 -m pip install discord.py

(但无论如何你都需要先有 pip)。

根据其网站,discord.py 不再支持 python 3.4,仅支持 python 3.5-3.8。希望这些信息能有所帮助。 :-)

打开 CMD 并转到您的 Discord 机器人的文件夹,例如:

cd C:\Users\max\Desktop\DiscordBot

接下来在 CMD 中输入:pip install discord.py 这应该有效

  1. 转到 python.org 并单击下载 python。

  2. 现在,打开并运行它。确保将 python 添加到路径中。单击安装。安装后您可以关闭它。

  3. 转到 git-scm.com 并单击 Windows.

    的下载
  4. 安装后打开。确保选择 Use git from windows command prompt。 然后点击下一步之后,点击安装。

  5. 安装完成后,点击完成。

  6. 复制你的脚本地址。就我而言,它是 Local//Programs//Python//Python39//Scripts

  7. 打开命令提示符并键入 cd Local//Programs//Python//Python39//Scripts。把你的地址贴在那里,我的地址不适合你。按 Enter。

  8. 然后输入py -3 -m pip install -U discord.py。再次点击进入。安装完成后关闭命令提示符。

现在您可以开始了 ;)

确保 Python 在您的系统路径中。

python -m pip install -u discord.py

使用:

py -m pip install discord.py

尝试在 CMD/Terminal 中输入 py -3.9 -m pip install discord.py[voice] --extra-index-url https://gorialis.github.io/pip/。它对我有用。感谢 @Gorilias On Github.

这应该有效:

pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]

但是,如果失败,我建议更新 pip 并重试。

如果您还遇到上述所有问题,请使用 Microsoft Store 安装 python 并在 command prompt

中使用上述命令

真正最简单的方法。 只需在命令提示符或终端中输入即可。

pip install discord-ext-alternatives

你也应该安装这个

pip install discord

当你要导入它的时候就用这个

import discord
from discord.ext import commands

bot \or whatever your variable is this = commands.Bot(command_prefix="prefix here")

其实很简单。打开命令提示符并写入:

pip install discord.py

之后如果你想要语音:

pip install discord.py[voice]

pip install discord.py 不建议从源 [branch:master] 安装,因为它处于测试阶段(截至 2021 年 5 月 30 日编写)。如果您想测试按钮,请务必继续 运行 pip install -U git+https://github.com/Rapptz/discord.py@master

截至 2021 年,默认安装命令:

pip install discord

将安装 discord.py

的“重写”(>1.0) 版本

要更新使用更新命令:

pip install discord --update