python - 无法在 python3.6、ubuntu 中导入 ethjsonrpc

标签 python ubuntu encode ethereum

导入时 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/

相关文章:

python - 如何抓取具有相同模式的不同类名

python - 在 Flask 中将表单 POST 对象转换为适合 mongodb 的表示形式

protocol-buffers - Nanopb -解码失败: zero tag

Java MD5 编码器与 C# MD5CryptoServiceProvider 不匹配

python - pandas:根据列表和另一列条件替换逗号分隔列中的相应值

javascript - S3 : Allow download of files for those who have some token

java - Tomcat 权限被拒绝/home/ubuntu 无法 GET,POST

docker 使用 apt-get 构建缓存破坏

Ruby:空间可能出现的 Ubuntu Gedit 问题

java - Base64.encode() 不适用于大字节数组