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

问题描述 投票:0回答:1

导入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'
python ubuntu encode ethereum
1个回答
1
投票

这是ethjsonrpc的一个问题,可以在github issue page上看到。建议的修复只是评论/usr/local/lib/python3.6/site-packages/ethereum/utils.py中的第103行

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

© www.soinside.com 2019 - 2024. All rights reserved.