安装 web3.py 时出错。 “python setup.py egg_info”
Posted
技术标签:
【中文标题】安装 web3.py 时出错。 “python setup.py egg_info”【英文标题】:Error while Install web3.py. "python setup.py egg_info" 【发布时间】:2021-11-04 00:18:47 【问题描述】:我正在尝试安装 web3.py (pip install web3) 并收到此错误: “python setup.py egg_info”失败。
如何解决这个问题并安装 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.
【问题讨论】:
【参考方案1】:请参阅:需要 Microsoft Visual C++ 14.0 或更高版本。使用“Microsoft C++ Build Tools”获取它:https://visualstudio.microsoft.com/visual-cpp-build-tools/
您需要一个 C 编译器来安装 web3.py 正在使用的依赖项。
【讨论】:
以上是关于安装 web3.py 时出错。 “python setup.py egg_info”的主要内容,如果未能解决你的问题,请参考以下文章
Web3.py - 即使安装了 web3,也无法导入“web3”