繁体   English   中英

错误 pip 在 windows 上安装 web3 即使在安装了 Microsoft 构建工具之后

[英]Error pip install web3 on windows even after installing microsoft build tools

我是 python 的新手,我一直在尝试安装 web3 几天,即使在安装了 Microsoft 构建工具并勾选了所有必需品(如 windows 10sdk 和所有 c++ 构建工具)之后。但我仍然收到此错误。我用谷歌搜索了这个问题,但仍然没有解决方案,让我停留在这一步,这真的很令人沮丧,我什至在安装微软构建工具后重新启动了我的系统,但我仍然收到以下错误。

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>py -m pip install web3
Collecting web3
  Using cached web3-5.28.0-py3-none-any.whl (499 kB)
Collecting aiohttp<4,>=3.7.4.post0
  Using cached aiohttp-3.8.1-cp310-cp310-win_amd64.whl (555 kB)
Collecting eth-abi<3.0.0,>=2.0.0b6
  Using cached eth_abi-2.1.1-py3-none-any.whl (27 kB)
Collecting hexbytes<1.0.0,>=0.1.0
  Using cached hexbytes-0.2.2-py3-none-any.whl (6.1 kB)
Collecting ipfshttpclient==0.8.0a2
  Using cached ipfshttpclient-0.8.0a2-py3-none-any.whl (82 kB)
Requirement already satisfied: pywin32>=223 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (303)
Collecting protobuf<4,>=3.10.0
  Using cached protobuf-3.19.4-cp310-cp310-win_amd64.whl (895 kB)
Collecting eth-account<0.6.0,>=0.5.7
  Using cached eth_account-0.5.7-py3-none-any.whl (101 kB)
Requirement already satisfied: eth-typing<3.0.0,>=2.0.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (2.3.0)
Requirement already satisfied: eth-hash[pycryptodome]<1.0.0,>=0.2.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (0.3.2)
Collecting lru-dict<2.0.0,>=1.1.6
  Using cached lru-dict-1.1.7.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
Collecting eth-utils<2.0.0,>=1.9.5
  Using cached eth_utils-1.10.0-py3-none-any.whl (24 kB)
Collecting websockets<10,>=9.1
  Using cached websockets-9.1.tar.gz (76 kB)
  Preparing metadata (setup.py) ... done
Collecting jsonschema<4.0.0,>=3.2.0
  Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
Requirement already satisfied: requests<3.0.0,>=2.16.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from web3) (2.27.1)
Collecting multiaddr>=0.0.7
  Using cached multiaddr-0.0.9-py2.py3-none-any.whl (16 kB)
Collecting attrs>=17.3.0
  Using cached attrs-21.4.0-py2.py3-none-any.whl (60 kB)
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<4,>=3.7.4.post0->web3) (2.0.12)
Collecting aiosignal>=1.1.2
  Using cached aiosignal-1.2.0-py3-none-any.whl (8.2 kB)
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.7.2-cp310-cp310-win_amd64.whl (122 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.3.0-cp310-cp310-win_amd64.whl (33 kB)
Collecting multidict<7.0,>=4.5
  Using cached multidict-6.0.2-cp310-cp310-win_amd64.whl (27 kB)
Collecting async-timeout<5.0,>=4.0.0a3
  Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting parsimonious<0.9.0,>=0.8.0
  Using cached parsimonious-0.8.1.tar.gz (45 kB)
  Preparing metadata (setup.py) ... done
Collecting rlp<3,>=1.0.0
  Using cached rlp-2.0.1-py2.py3-none-any.whl (20 kB)
Collecting bitarray<1.3.0,>=1.2.1
  Using cached bitarray-1.2.2.tar.gz (48 kB)
  Preparing metadata (setup.py) ... done
Collecting eth-keys<0.4.0,>=0.3.4
  Using cached eth_keys-0.3.4-py3-none-any.whl (21 kB)
Collecting eth-rlp<2,>=0.1.2
  Using cached eth_rlp-0.3.0-py3-none-any.whl (5.0 kB)
Collecting eth-keyfile<0.6.0,>=0.5.0
  Using cached eth_keyfile-0.5.1-py3-none-any.whl (8.3 kB)
Collecting pycryptodome<4,>=3.6.6
  Using cached pycryptodome-3.14.1-cp35-abi3-win_amd64.whl (1.8 MB)
Collecting cytoolz<1.0.0,>=0.10.1
  Using cached cytoolz-0.11.2.tar.gz (481 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from jsonschema<4.0.0,>=3.2.0->web3) (61.2.0)
Collecting six>=1.11.0
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pyrsistent>=0.14.0
  Using cached pyrsistent-0.18.1-cp310-cp310-win_amd64.whl (61 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from requests<3.0.0,>=2.16.0->web3) (1.26.9)
Requirement already satisfied: idna<4,>=2.5 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from requests<3.0.0,>=2.16.0->web3) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from requests<3.0.0,>=2.16.0->web3) (2021.10.8)
Requirement already satisfied: toolz>=0.8.0 in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from cytoolz<1.0.0,>=0.10.1->eth-utils<2.0.0,>=1.9.5->web3) (0.11.2)
Collecting eth-rlp<2,>=0.1.2
  Using cached eth_rlp-0.2.1-py3-none-any.whl (5.0 kB)
Collecting base58
  Using cached base58-2.1.1-py3-none-any.whl (5.6 kB)
Requirement already satisfied: varint in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from multiaddr>=0.0.7->ipfshttpclient==0.8.0a2->web3) (1.0.2)
Requirement already satisfied: netaddr in c:\users\kadit cuy\appdata\local\programs\python\python310\lib\site-packages (from multiaddr>=0.0.7->ipfshttpclient==0.8.0a2->web3) (0.8.0)
Using legacy 'setup.py install' for lru-dict, since package 'wheel' is not installed.
Using legacy 'setup.py install' for websockets, since package 'wheel' is not installed.
Using legacy 'setup.py install' for bitarray, since package 'wheel' is not installed.
Using legacy 'setup.py install' for cytoolz, since package 'wheel' is not installed.
Using legacy 'setup.py install' for parsimonious, since package 'wheel' is not installed.
Installing collected packages: lru-dict, bitarray, websockets, six, pyrsistent, pycryptodome, protobuf, multidict, hexbytes, frozenlist, cytoolz, base58, attrs, async-timeout, yarl, parsimonious, multiaddr, jsonschema, eth-utils, aiosignal, rlp, ipfshttpclient, eth-keys, eth-abi, aiohttp, eth-rlp, eth-keyfile, eth-account, web3
  Running setup.py install for lru-dict ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lru-dict did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      running install
      C:\Users\KADIT CUY\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'lru' 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/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lru-dict

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Please someone should help!!

您可以先尝试安装轮子: pip install wheel 然后你可以避免使用setup.py install

您可以像建议的错误消息一样将Microsoft Visual C++更新为 14 或更高版本。

旁注:错误源于安装lru-dict ,而不是直接安装web3

您似乎安装了 visual studio 2022。 您应该检查是否已安装编译 python 所需的所有可选功能(来自此处):

  • 安装 Python 开发工作负载和可选的 Python 本机开发工具选项。

  • 安装最新的 Windows SDK(安装程序中的 Native development 下)。

  • 可选:在构建之前将 $env:PlatformToolset 设置为你的工具集版本,如果它没有检测到的话。 (或者,您可以打开开发人员命令提示符)

  • 更新到最新setuptools Python package版本

特别是最后一个需要支持最新的编译器。 运行pip install --upgrade setuptools 然后尝试重新安装

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM