【问题标题】:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-_J7Ije/aiohttp/ when installing discord.py安装 discord.py 时,命令“python setup.py egg_info”在 /tmp/pip-build-_J7Ije/aiohttp/ 中失败,错误代码为 1
【发布时间】:2020-07-19 14:21:18
【问题描述】:

编辑:解决了!感谢@Raz Kissos 给予我很多帮助并耐心等待我和其他回答的人!我是 stackOverflow 的新手,如果这是一个问题,任何版主都可以锁定这个线程,因为我找不到它。

我正在尝试安装 discord.py 库,但这样做时,我收到了这个:

    Collecting discord.py
  Using cached https://files.pythonhosted.org/packages/97/3c/2a97b47fd8839f8863241857bbd6a3998d1de1662b788c8d9322e5a40901/discord.py-0.16.12.tar.gz
Collecting aiohttp<1.1.0,>=1.0.0 (from discord.py)
  Using cached https://files.pythonhosted.org/packages/09/5a/7b81ea8729d41f44c6fe6a116e466c8fb884950a0061aa3768dbd6bee2f8/aiohttp-1.0.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-_J7Ije/aiohttp/setup.py", line 60, in <module>
        raise RuntimeError("aiohttp requires Python 3.4.2+")
    RuntimeError: aiohttp requires Python 3.4.2+
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-_J7Ije/aiohttp/

当我使用这个命令时发生了这种情况:

pip install -U discord.py

这在树莓派 3B+ 上,使用 Raspbian 操作系统。 如果需要更多信息,我会提供:) 提前致谢!

【问题讨论】:

  • 您尝试过简单的pip install discord.py 吗?还要检查你的 python 版本并在需要时更新它,因为引发的异常是aiohttp requires Python 3.4.2+,所以你的 python 版本可能会更低。
  • 刚试过pip install discord.py,给了我Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-eaAMt6/aiohttp/(非常相似,但路径不同)。使用 python3.8 -V 告诉我我的版本是 3.8.0。
  • 你的机器上有几个python版本吗?
  • 不确定,如何检查/卸载它们?
  • 抱歉尝试ls /usr/bin/python*,它应该显示所有的python解释器。如果确实有多个安装,只需指定您将使用哪个 python 解释器运行 pip:python3 -m pip install discord.py

标签: python pip raspberry-pi3 discord.py setup.py


【解决方案1】:

由于错误表明您没有使用正确的 Python 版本,您应该尝试检查您是否安装了所需的 Python 版本。 如果你这样做了,它仍然显示这个错误,也许你的机器上有多个 python 安装。无需担心,只需指定要使用的 Python 解释器即可:

<python interpreter> -m pip install <module name> --user

例如:

python3.8 -m pip install discord.py --user

这只会将 discord.py 模块添加到 python3.8 解释器,因此请确保使用它来运行代码。

【讨论】:

  • 它确实说过Successfully installed aiohttp-3.6.2 async-timeout-3.0.1 attrs-19.3.0 chardet-3.0.4 discord.py-1.3.4 idna-2.10 idna-ssl-1.1.0 multidict-4.7.6 typing-extensions-3.7.4.2 websockets-6.0 yarl-1.4.2但是当做python3.8 filename.py时,它仍然找不到模块。
  • 使用python3 而不是python3.8,这些是不同的解释器。如果你想使用python3.8,你可以简单地运行python3.8 -m pip install &lt;module name&gt; --user。希望我编辑的答案可以帮助...
【解决方案2】:

试试:

pip install --upgrade setuptools wheel
pip install -U discord.py

如果这不起作用:

pip3 install -U discord.py

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-13
    • 2021-10-23
    • 2016-02-14
    • 2018-05-18
    • 2023-04-01
    • 2019-08-24
    • 2018-05-28
    • 2015-06-06
    相关资源
    最近更新 更多