PIP 无法构建包 cytoolz

PIP failed to build package cytoolz

我正在尝试使用 'pipx install eth-brownie' 安装 eth-brownie,但我收到一条错误消息

pip failed to build package: cytoolz
Some possibly relevant errors from pip install:
    build\lib.win-amd64-3.10\cytoolz\functoolz.cp310-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
    error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\link.exe' failed with exit code 1120

我查看了日志文件,它显示未能构建 cytoolz。它还提到“警报:未安装 Cython。没有 Cython 的建筑。”。根据我有限的理解,Cytoolz 是 Cython 的一部分,所以我认为 eth-brownie 安装失败的原因是因为它无法构建 cytoolz,因为它试图在没有 Cython 的情况下构建它。问题是我已经安装了 cython:

C:\Users\alaiy>pip install cython
Requirement already satisfied: cython in c:\python310\lib\site-packages (0.29.24)

从日志文件中提取(我可以粘贴整个内容,但它很长):

Building wheels for collected packages: bitarray, cytoolz, lru-dict, parsimonious, psutil, pygments-lexer-solidity, varint, websockets, wrapt
  Building wheel for bitarray (setup.py): started
  Building wheel for bitarray (setup.py): finished with status 'done'
  Created wheel for bitarray: filename=bitarray-1.2.2-cp310-cp310-win_amd64.whl size=55783 sha256=d4ae97234d659ed9ff1f0c0201e82c7e321bd3f4e122f6c2caee225172e7bfb2
  Stored in directory: c:\users\alaiy\appdata\local\pip\cache\wheelsd\a864620332cc833df35535f54074cf1e51f94d07d2a660bd6d
  Building wheel for cytoolz (setup.py): started
  Building wheel for cytoolz (setup.py): finished with status 'error'
  Running setup.py clean for cytoolz
  Building wheel for lru-dict (setup.py): started
  Building wheel for lru-dict (setup.py): finished with status 'done'
  Created wheel for lru-dict: filename=lru_dict-1.1.7-cp310-cp310-win_amd64.whl size=12674 sha256=6a7e7b2068eb8481650e0a2ae64c94223b3d2c018f163c5a0e7c1d442077450a
  Stored in directory: c:\users\alaiy\appdata\local\pip\cache\wheels[=12=]a\dc\b156cb52954bbc1c31b4766ca3f0ed9eae9b218812bca89d7b
  Building wheel for parsimonious (setup.py): started
  Building wheel for parsimonious (setup.py): finished with status 'done'
  Created wheel for parsimonious: filename=parsimonious-0.8.1-py3-none-any.whl size=42724 sha256=f9235a9614af0f5204d6bb35b8bd30b9456eae3021b5c2a9904345ad7d07a49d
  Stored in directory: c:\users\alaiy\appdata\local\pip\cache\wheels\b1\f1a2f39b30d6780ae9f2be9a52056595e0d97c1b4531d183085
  Building wheel for psutil (setup.py): started
  Building wheel for psutil (setup.py): finished with status 'done'
  Created wheel for psutil: filename=psutil-5.8.0-cp310-cp310-win_amd64.whl size=246135 sha256=834ab1fd1dd0c18e574fc0fbf07922e605169ac68be70b8a64fb90c49ad4ae9b
  Stored in directory: c:\users\alaiy\appdata\local\pip\cache\wheels\a3d5295409067d58a62a069d30d296d61d3ac132605e3a9555c
  Building wheel for pygments-lexer-solidity (setup.py): started
  Building wheel for pygments-lexer-solidity (setup.py): finished with status 'done'
  Created wheel for pygments-lexer-solidity: filename=pygments_lexer_solidity-0.7.0-py3-none-any.whl size=7321 sha256=46355292f790d07d941a745cd58b64c5592e4c24357f7cc80fe200c39ab88d32
  Stored in directory: c:\users\alaiy\appdata\local\pip\cache\wheels\fd\bcff4fe156d46016eca64c9652a1cd7af6411070c88acbeabf5
  Building wheel for varint (setup.py): started
  Building wheel for varint (setup.py): finished with status 'done'
  Created wheel for varint: filename=varint-1.0.2-py3-none-any.whl size=1979 sha256=36b744b26ba7534a494757e16ab6e171d9bb60a4fe4663557d57034f1150b678
  Stored in directory: c:\users\alaiy\appdata\local\pip\cache\wheelse919c52a2a695a512ca394a5308dd12626a40bbcd288de814
  Building wheel for websockets (setup.py): started
  Building wheel for websockets (setup.py): finished with status 'done'
  Created wheel for websockets: filename=websockets-9.1-cp310-cp310-win_amd64.whl size=91765 sha256=a00a9c801269ea2b86d72c0b0b654dc67672519721afeac8f912a157e52901c0
  Stored in directory: c:\users\alaiy\appdata\local\pip\cache\wheels\f7e3eca27ecd6d7230caff265283a5a5112ad4cd1d945c022dd
  Building wheel for wrapt (setup.py): started
  Building wheel for wrapt (setup.py): finished with status 'done'
  Created wheel for wrapt: filename=wrapt-1.12.1-cp310-cp310-win_amd64.whl size=33740 sha256=ccd729b6e3915164ac4994aef731f21cd232466b3f6c4823c9fda14b07e821c3
  Stored in directory: c:\users\alaiy\appdata\local\pip\cache\wheelse\d3\d9e7053100177668fa43216a8082868c55015f8706abd974f2
Successfully built bitarray lru-dict parsimonious psutil pygments-lexer-solidity varint websockets wrapt
Failed to build cytoolz
Installing collected packages: toolz, eth-typing, eth-hash, cytoolz, six, pyparsing, eth-utils, varint, urllib3, toml, rlp, pyrsistent, pycryptodome, py, pluggy, parsimonious, packaging, netaddr, multidict, iniconfig, idna, hexbytes, eth-keys, colorama, charset-normalizer, certifi, base58, attrs, atomicwrites, yarl, typing-extensions, requests, python-dateutil, pytest, multiaddr, jsonschema, inflection, eth-rlp, eth-keyfile, eth-abi, chardet, bitarray, async-timeout, websockets, wcwidth, tomli, sortedcontainers, semantic-version, regex, pywin32, pytest-forked, pyjwt, pygments, protobuf, platformdirs, pathspec, mythx-models, mypy-extensions, lru-dict, ipfshttpclient, execnet, eth-account, dataclassy, click, asttokens, aiohttp, wrapt, web3, vyper, vvm, tqdm, pyyaml, pythx, python-dotenv, pytest-xdist, pygments-lexer-solidity, py-solc-x, py-solc-ast, psutil, prompt-toolkit, lazy-object-proxy, hypothesis, eth-event, eip712, black, eth-brownie
    Running setup.py install for cytoolz: started
    Running setup.py install for cytoolz: finished with status 'error'

PIP STDERR
----------
WARNING: The candidate selected for download or install is a yanked version: 'protobuf' candidate (version 3.18.0 at https://files.pythonhosted.org/packages/74/4e/9f3cb458266ef5cdeaa1e72a90b9eda100e3d1803cbd7ec02f0846da83c3/protobuf-3.18.0-py2.py3-none-any.whl#sha256=615099e52e9fbc9fde00177267a94ca820ecf4e80093e390753568b7d8cb3c1a (from https://pypi.org/simple/protobuf/))
Reason for being yanked: This version claims to support Python 2 but does not
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\alaiy\.local\pipx\venvs\eth-brownie\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\alaiy\AppData\Local\Temp\pip-install-d1bskwa2\cytoolz_f765f335272241adba2138f1920a35cd\setup.py'"'"'; __file__='"'"'C:\Users\alaiy\AppData\Local\Temp\pip-install-d1bskwa2\cytoolz_f765f335272241adba2138f1920a35cd\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\alaiy\AppData\Local\Temp\pip-wheel-pxzumeav'
       cwd: C:\Users\alaiy\AppData\Local\Temp\pip-install-d1bskwa2\cytoolz_f765f335272241adba2138f1920a35cd\
  Complete output (70 lines):
  ALERT: Cython not installed.  Building without Cython.
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.10
  creating build\lib.win-amd64-3.10\cytoolz
  copying cytoolz\compatibility.py -> build\lib.win-amd64-3.10\cytoolz
  copying cytoolz\utils_test.py -> build\lib.win-amd64-3.10\cytoolz

如有任何帮助,我们将不胜感激!

编辑:找到解决方案。 Python 3.10 似乎不支持 Cython(参考 https://github.com/eth-brownie/brownie/issues/1300 and https://github.com/cython/cython/issues/4046)。我降级到 Python 3.9.7 并且 eth-brownie 安装成功了!)

我使用了 pip install eth-brownie 并且运行良好,我不需要降级。 我是新手,也许我可能是错的,但它对我来说效果很好。

首先在安装 cython 和 cytoolz 的 Win10 x64 上设法让它与 python 3.10.1 一起工作:

python -m pip install --user cython
python -m pip install --user cytoolz
python -m pip install --user eth-brownie

https://github.com/eth-brownie/brownie/issues/1315

我遇到了同样的问题并这样做了...

python -m pip install --user cython
python -m pip install --user cytoolz
python -m pip install --user eth-brownie
python -m pip install --user pipx
python -m pipx ensurepath

# RESTARTED TERMINAL
pipx install eth-brownie

我当时很高兴,可以在终端中输入“brownie”而不会出现错误。我正在阅读的一些文档有 python3 并且删除 3 似乎有效。