Python
彈出作業系統錯誤:和rrno2和rrn這2Errno 2沒有相應的文件和目錄
嘗試時:
$populus compile
得到:
OSError: [Errno 2] No such file or directory
試過:
嘗試按照此處所述安裝缺少的依賴項並安裝了solidity編譯器- 結果相同。在 sudo 或 virtualenv 下的結果相同。populus init按預期工作。
GitHub 上的相關問題。
完整的控制台輸出:
============ Compiling ============== > Loading contracts from: /home/petr/Projects/populus-tests/contracts Traceback (most recent call last): File "/usr/local/bin/populus", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/populus/cli/compile_cmd.py", line 46, in compile_contracts result = compile_and_write_contracts(project_dir, *filters, optimize=optimize) File "/usr/local/lib/python2.7/dist-packages/populus/compilation.py", line 161, in compile_and_write_contracts **compiler_kwargs File "/usr/local/lib/python2.7/dist-packages/populus/compilation.py", line 94, in compile_project_contracts **compiler_kwargs File "/usr/local/lib/python2.7/dist-packages/populus/compilation.py", line 81, in compile_source_file **compiler_kwargs File "/usr/local/lib/python2.7/dist-packages/populus/solidity.py", line 52, in solc stderr=subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 711, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory
安裝一些其他工具(如 EthereumJS testrpc)後,問題自行解決了。我猜是我的電腦上沒有正確安裝的 solc 編譯器。
用於從原始碼建構solidity 編譯器,然後將其安裝為npm 包,這更容易。
所以,如果你有同樣的問題。嘗試檢查solc命令是否有效。
錯誤是說您沒有目錄:
/home/petr/Projects/populus-tests/contracts
是這樣嗎?如果是,則創建它並將您的契約源文件複製到其中。