我c了,Mac配置半天一直报错,windows随便配置就ok
Os:Windows
PythonVersion:3.9.8(python3.10会报错,建议不要使用python3.10)
pip3 install py-solc
注释solc源码中 clone-bin,否则会报错
Traceback (most recent call last): File "C:UsersAdministratorDesktopdevmain.py", line 4, ina = compile_files(sol_file) File "C:UsersAdministratorAppDataLocalProgramsPythonPython39libsite-packagessolcmain.py", line 135, in compile_files stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs) File "C:UsersAdministratorAppDataLocalProgramsPythonPython39libsite-packagessolcutilsstring.py", line 85, in inner return force_obj_to_text(fn(*args, **kwargs)) File "C:UsersAdministratorAppDataLocalProgramsPythonPython39libsite-packagessolcwrapper.py", line 164, in solc_wrapper raise SolcError( solc.exceptions.SolcError: An error occurred during execution > command: `solc --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,devdoc,interface,opcodes,userdoc hello.sol` > return code: `1` > stderr: > stdout: Invalid option to --combined-json: clone-bin
2.下载solc文件,并且放在项目文件夹下,或者增加环境变量(或者丢到system32)
Python Code
参考资料:
GitHub - ethereum/py-solc: Python wrapper around the solc Solidity compiler.



