Solc

通過 py-solc 編譯 Solidity 程式碼時出錯

  • August 11, 2021

嘗試通過py-solc. 是因為新的更新py-solc嗎?我該如何解決?

>>> from . import views
 File "/home/manzik/Desktop/Ethereum Voting/voting/home/views.py", line 5, in <module>
   import commission.views as comm
 File "/home/manzik/Desktop/Ethereum Voting/voting/commission/views.py", line 164, in <module>
   compiled_sol = compile_source(contract_source_code)
 File "/home/manzik/.local/lib/python3.6/site-packages/solc/main.py", line 108, in compile_source
   stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
 File "/home/manzik/.local/lib/python3.6/site-packages/solc/utils/string.py", line 85, in inner
   return force_obj_to_text(fn(*args, **kwargs))
 File "/home/manzik/.local/lib/python3.6/site-packages/solc/wrapper.py", line 169, in solc_wrapper
   stderr_data=stderrdata,
solc.exceptions.SolcError: An error occurred during execution
> command: `solc --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,devdoc,interface,opcodes,userdoc`
> return code: `1`
> stderr:

> stdout:
Invalid option to --combined-json: clone-bin

py-solc 已棄用且不支持solc版本^0.5.0。您發布的錯誤與嘗試使用0.5.x版本進行編譯一致。

我已經將該項目分叉為py-solc-x並繼續維護它。您可以通過 pip 安裝它:

pip install py-solc-x

請記住,這不再是乙太坊耍蛇人的官方版本。我鼓勵您在使用之前查看Github上的程式碼。

試試 python3 -m solc.install v0.4.25

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