导入时 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 使用这个模块可能是个好主意。
关于python - 无法在 python3.6、ubuntu 中导入 ethjsonrpc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52272285/