如何解决在 windows 中为 python 安装 web3 的问题?

How solve problem with installing web3 for python in windows?

我正在尝试在 windows 10 上为 python3.7.5 安装 web3。但我每次都会遇到此错误。我不知道该怎么办,因为我已经安装了“Microsoft Visual C++ 14.0”和 Build Tools。我也试过在虚拟环境中安装,但它以同样的错误结束。谢谢你的建议。

  Building wheel for lru-dict (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Žaneta\AppData\Local\Temp\pip-install-p2lk_xob\lru-dict\setup.py'"'"'; __file__='"'"'C:\Users\Žaneta\AppData\Local\Temp\pip-install-p2lk_xob\lru-dict\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Žaneta\AppData\Local\Temp\pip-wheel-89ed3hox'
       cwd: C:\Users\Žaneta\AppData\Local\Temp\pip-install-p2lk_xob\lru-dict\
  Complete output (5 lines):
  running bdist_wheel
  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/
  ----------------------------------------

问题已解决。 Cytoolz 支持 Python 2.7+ 和 Python 3.4+。我有 Python 3.8.5,所以现在我在 Python 3.2 上 运行 并且安装了 Web3

给出错误信息:

error: Microsoft Visual C++ 14.0 or greater is required. 

您可能只需要 Microsoft Visual C++ 14.0 或更高版本。

我知道这已经很老了,但是对于遇到这个问题的任何人,我都按照 github

上发布的解决方案解决了这个问题

这是解决方案:

  1. 安装Visual Studio构建工具here
  2. Select“使用 C++ 进行桌面开发”安装工作负载(大约 6GB)
  3. 完成安装并重启电脑
  4. 打开终端并重试 pip install web3

Screenshot of the workload needed