无法在 python3.6 , ubuntu 中导入 ethjsonrpc

can't import ethjsonrpc in python3.6 , ubuntu

导入时 ethjsonrpc 抛出如下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/ethjsonrpc/__init__.py", line 1, in <module>
    from ethjsonrpc.client import (EthJsonRpc, ParityEthJsonRpc,
  File "/usr/local/lib/python3.6/site-packages/ethjsonrpc/client.py", line 7, in <module>
    from ethereum import utils
  File "/usr/local/lib/python3.6/site-packages/ethereum/utils.py", line 103, in <module>
    assert sha3('').encode('hex') == 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
AttributeError: 'bytes' object has no attribute 'encode'

这是 ethjsonrpc 的一个问题,可以在 github issue page 上看到。建议的修复方法是仅注释 /usr/local/lib/python3.6/site-packages/ethereum/utils.py

中的第 103 行

切换到将此模块与 python2 一起使用可能是个好主意,以防出现更多由版本差异引起的错误。