Python:Discord.py错误:无法为使用PEP 517且无法直接安装的multidict,yarl构建轮子

时间:2020-11-10 04:33:01

标签: python pip discord.py discord.py-rewrite

所以我最近尝试通过cmd安装discord.py,但是无论我是否使用pip3 py pip,它都会给我一个错误。它说我需要安装Visual Studio 14,但我已经安装了Visual Studio 16。

我已经卸载并重新安装了python 3.9.0,我已经通过'pip install --upgrade pip'进行了更新,它仍然给我同样的错误。

这是错误:

Microsoft Windows [Version 10.0.18363.1139]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\rektb>pip

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  cache                       Inspect and manage pip's wheel cache.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to
                              WARNING, ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --no-input                  Disable prompting for input.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup,
                              (a)bort.
  --trusted-host <hostname>   Mark this host or host:port pair as trusted, even though it does not have valid or any
                              HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the
                              certificate in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for
                              download. Implied with --no-index.
  --no-color                  Suppress colored output
  --no-python-version-warning
                              Silence deprecation warnings for upcoming unsupported Pythons.
  --use-feature <feature>     Enable new functionality, that may be backward incompatible.
  --use-deprecated <feature>  Enable deprecated functionality, that will be removed in the future.

C:\Users\rektb>pip install discord
Collecting discord
  Downloading discord-1.0.1-py3-none-any.whl (1.1 kB)
Collecting discord.py>=1.0.1
  Using cached discord.py-1.5.1-py3-none-any.whl (701 kB)
Processing c:\users\rektb\appdata\local\pip\cache\wheels\b6\9c\bd\6b99bc6ec9dab11f3756d31fb8506d3ecf07aea58b6201f539\aiohttp-3.6.3-py3-none-any.whl
Collecting chardet<4.0,>=2.0
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting yarl<1.6.0,>=1.0
  Using cached yarl-1.5.1.tar.gz (173 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting multidict<5.0,>=4.5
  Using cached multidict-4.7.6.tar.gz (50 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting attrs>=17.3.0
  Using cached attrs-20.3.0-py2.py3-none-any.whl (49 kB)
Collecting async-timeout<4.0,>=3.0
  Using cached async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting idna>=2.0
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Building wheels for collected packages: yarl, multidict
  Building wheel for yarl (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\rektb\appdata\local\programs\python\python39\python.exe' 'c:\users\rektb\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\rektb\AppData\Local\Temp\tmpu8kj7th3'
       cwd: C:\Users\rektb\AppData\Local\Temp\pip-install-g82ywazb\yarl
  Complete output (35 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_py.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\_url.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\__init__.py -> build\lib.win-amd64-3.9\yarl
  running egg_info
  writing yarl.egg-info\PKG-INFO
  writing dependency_links to yarl.egg-info\dependency_links.txt
  writing requirements to yarl.egg-info\requires.txt
  writing top-level names to yarl.egg-info\top_level.txt
  reading manifest file 'yarl.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files matching '*.cache' found anywhere in distribution
  warning: no previously-included files found matching 'yarl\*.html'
  warning: no previously-included files found matching 'yarl\*.so'
  warning: no previously-included files found matching 'yarl\*.pyd'
  no previously-included directories found matching 'docs\_build'
  writing manifest file 'yarl.egg-info\SOURCES.txt'
  copying yarl\__init__.pyi -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.c -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.pyi -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.pyx -> build\lib.win-amd64-3.9\yarl
  copying yarl\py.typed -> build\lib.win-amd64-3.9\yarl
  running build_ext
  building 'yarl._quoting_c' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for yarl
  Building wheel for multidict (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\rektb\appdata\local\programs\python\python39\python.exe' 'c:\users\rektb\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\rektb\AppData\Local\Temp\tmpjhq6cm0_'
       cwd: C:\Users\rektb\AppData\Local\Temp\pip-install-g82ywazb\multidict
  Complete output (40 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\multidict
  copying multidict\_abc.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_compat.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict_base.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict_py.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\__init__.py -> build\lib.win-amd64-3.9\multidict
  running egg_info
  writing multidict.egg-info\PKG-INFO
  writing dependency_links to multidict.egg-info\dependency_links.txt
  writing top-level names to multidict.egg-info\top_level.txt
  reading manifest file 'multidict.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files found matching 'multidict\_multidict.html'
  warning: no previously-included files found matching 'multidict\*.so'
  warning: no previously-included files found matching 'multidict\*.pyd'
  warning: no previously-included files found matching 'multidict\*.pyd'
  no previously-included directories found matching 'docs\_build'
  writing manifest file 'multidict.egg-info\SOURCES.txt'
  copying multidict\__init__.pyi -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict.c -> build\lib.win-amd64-3.9\multidict
  copying multidict\py.typed -> build\lib.win-amd64-3.9\multidict
  creating build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\defs.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\dict.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\istr.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\iter.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\pair_list.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\views.h -> build\lib.win-amd64-3.9\multidict\_multilib
  running build_ext
  building 'multidict._multidict' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for multidict
Failed to build yarl multidict
ERROR: Could not build wheels for yarl, multidict which use PEP 517 and cannot be installed directly

C:\Users\rektb>pip install --update

Usage:
  pip install [options] <requirement specifier> [package-index-options] ...
  pip install [options] -r <requirements file> [package-index-options] ...
  pip install [options] [-e] <vcs project url> ...
  pip install [options] [-e] <local project path> ...
  pip install [options] <archive url/path> ...

no such option: --update

C:\Users\rektb>pip install -update

Usage:
  pip install [options] <requirement specifier> [package-index-options] ...
  pip install [options] -r <requirements file> [package-index-options] ...
  pip install [options] [-e] <vcs project url> ...
  pip install [options] [-e] <local project path> ...
  pip install [options] <archive url/path> ...

no such option: -u

C:\Users\rektb>pip install update
Collecting update
  Downloading update-0.0.1-py2.py3-none-any.whl (2.9 kB)
Collecting style==1.1.0
  Downloading style-1.1.0-py2.py3-none-any.whl (6.4 kB)
Installing collected packages: style, update
Successfully installed style-1.1.0 update-0.0.1

C:\Users\rektb>pip install discord
Collecting discord
  Using cached discord-1.0.1-py3-none-any.whl (1.1 kB)
Collecting discord.py>=1.0.1
  Using cached discord.py-1.5.1-py3-none-any.whl (701 kB)
Processing c:\users\rektb\appdata\local\pip\cache\wheels\b6\9c\bd\6b99bc6ec9dab11f3756d31fb8506d3ecf07aea58b6201f539\aiohttp-3.6.3-py3-none-any.whl
Collecting yarl<1.6.0,>=1.0
  Using cached yarl-1.5.1.tar.gz (173 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting chardet<4.0,>=2.0
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting multidict<5.0,>=4.5
  Using cached multidict-4.7.6.tar.gz (50 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting attrs>=17.3.0
  Using cached attrs-20.3.0-py2.py3-none-any.whl (49 kB)
Collecting async-timeout<4.0,>=3.0
  Using cached async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting idna>=2.0
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Building wheels for collected packages: yarl, multidict
  Building wheel for yarl (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\rektb\appdata\local\programs\python\python39\python.exe' 'c:\users\rektb\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\rektb\AppData\Local\Temp\tmp18h1y_37'
       cwd: C:\Users\rektb\AppData\Local\Temp\pip-install-gd6ywrpo\yarl
  Complete output (35 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_py.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\_url.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\__init__.py -> build\lib.win-amd64-3.9\yarl
  running egg_info
  writing yarl.egg-info\PKG-INFO
  writing dependency_links to yarl.egg-info\dependency_links.txt
  writing requirements to yarl.egg-info\requires.txt
  writing top-level names to yarl.egg-info\top_level.txt
  reading manifest file 'yarl.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files matching '*.cache' found anywhere in distribution
  warning: no previously-included files found matching 'yarl\*.html'
  warning: no previously-included files found matching 'yarl\*.so'
  warning: no previously-included files found matching 'yarl\*.pyd'
  no previously-included directories found matching 'docs\_build'
  writing manifest file 'yarl.egg-info\SOURCES.txt'
  copying yarl\__init__.pyi -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.c -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.pyi -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.pyx -> build\lib.win-amd64-3.9\yarl
  copying yarl\py.typed -> build\lib.win-amd64-3.9\yarl
  running build_ext
  building 'yarl._quoting_c' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for yarl
  Building wheel for multidict (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\rektb\appdata\local\programs\python\python39\python.exe' 'c:\users\rektb\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\rektb\AppData\Local\Temp\tmp5crgjgpn'
       cwd: C:\Users\rektb\AppData\Local\Temp\pip-install-gd6ywrpo\multidict
  Complete output (40 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\multidict
  copying multidict\_abc.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_compat.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict_base.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict_py.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\__init__.py -> build\lib.win-amd64-3.9\multidict
  running egg_info
  writing multidict.egg-info\PKG-INFO
  writing dependency_links to multidict.egg-info\dependency_links.txt
  writing top-level names to multidict.egg-info\top_level.txt
  reading manifest file 'multidict.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files found matching 'multidict\_multidict.html'
  warning: no previously-included files found matching 'multidict\*.so'
  warning: no previously-included files found matching 'multidict\*.pyd'
  warning: no previously-included files found matching 'multidict\*.pyd'
  no previously-included directories found matching 'docs\_build'
  writing manifest file 'multidict.egg-info\SOURCES.txt'
  copying multidict\__init__.pyi -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict.c -> build\lib.win-amd64-3.9\multidict
  copying multidict\py.typed -> build\lib.win-amd64-3.9\multidict
  creating build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\defs.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\dict.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\istr.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\iter.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\pair_list.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\views.h -> build\lib.win-amd64-3.9\multidict\_multilib
  running build_ext
  building 'multidict._multidict' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for multidict
Failed to build yarl multidict
ERROR: Could not build wheels for yarl, multidict which use PEP 517 and cannot be installed directly

C:\Users\rektb>pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\rektb\appdata\local\programs\python\python39\lib\site-packages (20.2.4)

C:\Users\rektb>

请帮助我,谢谢您<3

1 个答案:

答案 0 :(得分:0)

discord.py的两个依赖项(如果使用语音则为三个)尚未为Python 3.9.0预先构建好轮子,必须从源代码进行编译。您有三种选择。

  1. 安装Micosoft Visual C ++独立编译器(https://wiki.python.org/moin/WindowsCompilers),并尝试在没有声音的情况下安装discord.py(PyNaCl在Windows上仍然有问题)。

    1a)或者,您可以安装从https://www.lfd.uci.edu/~gohlke/pythonlibs/预编译的这两个轮子(yar,multidict)。请注意,此处未提供PyNaCl。

  2. 降级到Python 3.8.6,它确实为所有discord.py的依赖项预先构建了轮子。