Solidity

無法在 Windows 上安裝 web3.py:無法打開包含文件:“io.h”:

  • April 26, 2022

我無法執行 pip install web3。它給了我這個錯誤

為 lru-dict 執行 setup.py install … 錯誤錯誤:subprocess-exited-with-error

× Running setup.py install for lru-dict did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
running install
C:\Users\Rishi Garg personal\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
lru.c
C:\Users\Rishi Garg personal\AppData\Local\Programs\Python\Python310\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file
error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x64\cl.exe' failed with exit code 2
[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.
PS C:\Users\Rishi Garg personal\demos\web3_py_simple_storage> python deploy.py
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "C:\Users\Rishi Garg personal\demos\web3_py_simple_storage\deploy.py", line 7, in
from web3 import Web3
ModuleNotFoundError: No module named 'web3'

你有沒有安裝 pip install python-dev-tools

× 嘗試安裝包時遇到錯誤。╰─> lru-dict

^^^^

我建議安裝此軟體包並查看您遇到的錯誤。這就是問題所在。點安裝 lru-dict

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