每次我尝试下载discord.py都不起作用。

huangapple go评论98阅读模式
英文:

Every time I try to download discord.py it doesnt work

问题

我写了以下内容:

pip install discord.py

它显示了以下错误信息:

File "<stadin>", line 1
pip install discord.py
SyntaxError: invalid syntax

我尝试写成:

$ pip install discord.py

但是出现了相同的问题。

我还尝试写成:

py -3 -m pip install -U discord.py

但是问题依然存在。我需要你们的帮助。

英文:

I write

pip install discord.py

it says

File &quot;&lt;stadin&gt;&quot;, line 1
pip install discord.py
SyntaxError: invalid syntax

I try to wirte

$ pip install discord.py

it was the same problem

I try to write

py -3 -m pip install -U discord.py

It was the same problem. I need your help, guys

答案1

得分: 1

你不需要在文件或Python REPL中编写pip install discord,而是需要在终端或命令提示符中输入该命令,告诉Python安装discord库。如果你使用的是Linux/Mac系统,请打开终端;如果是Windows系统,请打开cmd或powershell,并运行以下命令:

python -m pip install discord.py

之前你所做的是输入python,这将进入Python解释器(Python REPL),然后你输入了pip install discord.py,好像它是Python代码(实际上不是,它是一个终端命令)。

英文:

You don't write pip install discord in a file / in the python REPL, you type this into a terminal or command prompt itself, to tell python to install discord. If your on linux/mac, open a terminal, on windows, open cmd or powershell, and run:

python -m pip install discord.py

What you did previously was type python, which dropped you into a Python interpreter (python REPL), and you typed pip install discord.py, as if it were python code (its not, its a terminal command).

答案2

得分: -1

你应该先进入Python模式,然后输入pip install discord.py,这样做是不可取的。
你应该直接在cmd窗口下执行它,它会正常工作。
点击这里查看图片描述

英文:

You should enter the python mode first and enter pip install discord.pythis is not advisable。
You should execute it directly under the cmd window, it will work normally。
enter image description here

答案3

得分: -1

我没有遇到安装discord.py的问题。我使用的是Python 3.10.0pip 22.3.1进行测试。

pip install discord.py
Collecting discord.py
  Downloading discord.py-2.1.0-py3-none-any.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 2.6 MB/s eta 0:00:00
Collecting aiohttp&lt;4,&gt;=3.7.4
  Downloading aiohttp-3.8.3-cp310-cp310-macosx_10_9_x86_64.whl (358 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 358.3/358.3 kB 5.3 MB/s eta 0:00:00
Requirement already satisfied: attrs&gt;=17.3.0 in /Volumes/SP PHD U3/python/venvs/tempPrj/lib/python3.10/site-packages (from aiohttp&lt;4,&gt;=3.7.4-&gt;discord.py) (22.2.0)
Collecting yarl&lt;2.0,&gt;=1.0
  Downloading yarl-1.8.2-cp310-cp310-macosx_10_9_x86_64.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.0/61.0 kB 3.6 MB/s eta 0:00:00
Collecting async-timeout&lt;5.0,&gt;=4.0.0a3
  Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting aiosignal&gt;=1.1.2
  Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting multidict&lt;7.0,&gt;=4.5
  Downloading multidict-6.0.4-cp310-cp310-macosx_10_9_x86_64.whl (29 kB)
Requirement already satisfied: charset-normalizer&lt;3.0,&gt;=2.0 in /Volumes/SP PHD U3/python/venvs/tempPrj/lib/python3.10/site-packages (from aiohttp&lt;4,&gt;=3.7.4-&gt;discord.py) (2.1.1)
Collecting frozenlist&gt;=1.1.1
  Downloading frozenlist-1.3.3-cp310-cp310-macosx_10_9_x86_64.whl (35 kB)
Requirement already satisfied: idna&gt;=2.0 in /Volumes/SP PHD U3/python/venvs/tempPrj/lib/python3.10/site-packages (from yarl&lt;2.0,&gt;=1.0-&gt;aiohttp&lt;4,&gt;=3.7.4-&gt;discord.py) (3.4)
Installing collected packages: multidict, frozenlist, async-timeout, yarl, aiosignal, aiohttp, discord.py
Successfully installed aiohttp-3.8.3 aiosignal-1.3.1 async-timeout-4.0.2 discord.py-2.1.0 frozenlist-1.3.3 multidict-6.0.4 yarl-1.8.2
英文:

I did not face a problem to install discord.py. I tested with Python 3.10.0 and pip 22.3.1

pip install discord.py
Collecting discord.py
  Downloading discord.py-2.1.0-py3-none-any.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 2.6 MB/s eta 0:00:00
Collecting aiohttp&lt;4,&gt;=3.7.4
  Downloading aiohttp-3.8.3-cp310-cp310-macosx_10_9_x86_64.whl (358 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 358.3/358.3 kB 5.3 MB/s eta 0:00:00
Requirement already satisfied: attrs&gt;=17.3.0 in /Volumes/SP PHD U3/python/venvs/tempPrj/lib/python3.10/site-packages (from aiohttp&lt;4,&gt;=3.7.4-&gt;discord.py) (22.2.0)
Collecting yarl&lt;2.0,&gt;=1.0
  Downloading yarl-1.8.2-cp310-cp310-macosx_10_9_x86_64.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.0/61.0 kB 3.6 MB/s eta 0:00:00
Collecting async-timeout&lt;5.0,&gt;=4.0.0a3
  Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting aiosignal&gt;=1.1.2
  Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting multidict&lt;7.0,&gt;=4.5
  Downloading multidict-6.0.4-cp310-cp310-macosx_10_9_x86_64.whl (29 kB)
Requirement already satisfied: charset-normalizer&lt;3.0,&gt;=2.0 in /Volumes/SP PHD U3/python/venvs/tempPrj/lib/python3.10/site-packages (from aiohttp&lt;4,&gt;=3.7.4-&gt;discord.py) (2.1.1)
Collecting frozenlist&gt;=1.1.1
  Downloading frozenlist-1.3.3-cp310-cp310-macosx_10_9_x86_64.whl (35 kB)
Requirement already satisfied: idna&gt;=2.0 in /Volumes/SP PHD U3/python/venvs/tempPrj/lib/python3.10/site-packages (from yarl&lt;2.0,&gt;=1.0-&gt;aiohttp&lt;4,&gt;=3.7.4-&gt;discord.py) (3.4)
Installing collected packages: multidict, frozenlist, async-timeout, yarl, aiosignal, aiohttp, discord.py
Successfully installed aiohttp-3.8.3 aiosignal-1.3.1 async-timeout-4.0.2 discord.py-2.1.0 frozenlist-1.3.3 multidict-6.0.4 yarl-1.8.2

答案4

得分: -2

根据PyPi服务器上的discord.py包

> 需要Python版本>=3.8.0

您可以使用以下命令检查您的Python版本:

python --version

如果不起作用,请尝试:

python3 --version

如果版本是3.7或更低,则应更新您的Python安装到3.8或更高,然后再次尝试在终端上运行pip命令。

pip install discord.py
英文:

As per discord.py package on PyPi server:

> Required Python >=3.8.0

You can check your Python version using:

python --version

Or if that doesn't work

python3 --version

If version is 3.7 or less, then you should update your Python installation to 3.8 or above and try again running pip command on terminal.

pip install discord.py

huangapple
  • 本文由 发表于 2023年1月8日 22:13:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/75048431.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定