Go-Ethereum

安裝 web3.py 時出錯。“python setup.py egg_info”:需要 Microsoft Visual C++ 14.0 或更高版本

  • September 23, 2021

我正在嘗試安裝 web3.py 並收到此錯誤:

   ERROR: Command errored out with exit status 1:
    command: 'C:\Users\onlyd\AppData\Local\Continuum\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\onlyd\\AppData\\Local\\Temp\\pip-install-ji347dtb\\pycryptodome\\setup.py'"'"'; __file__='"'"'C:\\Users\\onlyd\\AppData\\Local\\Temp\\pip-install-ji347dtb\\pycryptodome\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
        cwd: C:\Users\onlyd\AppData\Local\Temp\pip-install-ji347dtb\pycryptodome\
   Complete output (20 lines):
   Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "C:\Users\onlyd\AppData\Local\Temp\pip-install-ji347dtb\pycryptodome\setup.py", line 468, in <module>
       set_compiler_options(package_root, ext_modules)
     File "C:\Users\onlyd\AppData\Local\Temp\pip-install-ji347dtb\pycryptodome\compiler_opt.py", line 341, in set_compiler_options
       clang = compiler_is_clang()
     File "C:\Users\onlyd\AppData\Local\Temp\pip-install-ji347dtb\pycryptodome\compiler_opt.py", line 251, in compiler_is_clang
       return test_compilation(source, msg="clang")
     File "C:\Users\onlyd\AppData\Local\Temp\pip-install-ji347dtb\pycryptodome\compiler_opt.py", line 82, in test_compilation
       objects = compiler.compile([fname], extra_postargs=extra_cc_options)
     File "C:\Users\onlyd\AppData\Local\Continuum\anaconda3\lib\distutils\_msvccompiler.py", line 346, in compile
       self.initialize()
     File "C:\Users\onlyd\AppData\Local\Continuum\anaconda3\lib\distutils\_msvccompiler.py", line 239, in initialize
       vc_env = _get_vc_env(plat_spec)
     File "C:\Users\onlyd\AppData\Local\Continuum\anaconda3\lib\site-packages\setuptools\msvc.py", line 316, in msvc14_get_vc_env
       return _msvc14_get_vc_env(plat_spec)
     File "C:\Users\onlyd\AppData\Local\Continuum\anaconda3\lib\site-packages\setuptools\msvc.py", line 271, in _msvc14_get_vc_env
       "Unable to find vcvarsall.bat"
   distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
   Testing support for clang
   ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

看到這個:Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

您需要一個 C 編譯器來安裝 web3.py 正在使用的依賴項。

如果您不想安裝“Microsoft C++ Build Tools”,您可以bitarray在此處下載 prebuilt:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#bitarray

然後執行pip3 install bitarray‑2.3.4‑cp310‑cp310‑win_amd64.whl,取決於您使用的 python 版本。

引用自:https://ethereum.stackexchange.com/questions/109488