首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pytest test_contracts.py错误: ImportError:无法导入名称state_transition

pytest test_contracts.py错误: ImportError:无法导入名称state_transition
EN

Ethereum用户
提问于 2016-07-02 15:14:05
回答 1查看 1.7K关注 0票数 1

在运行Ubuntu16.04和Python2.7.11+的旧ThinkPad T500上,我很难按照这里这里的安装说明来设置pyethereum。

当我用以下方法测试安装时:

代码语言:javascript
复制
pyethereum/ethereum/tests$ pytest -m test_contracts.py

我得到了,例如:

代码语言:javascript
复制
going into /home/pavel/Ethereum/pyethereum/ethereum/tests
============================  test_db.py  ============================

===========================  test_abi.py  ============================ 
unhandled exception occurred while testing test_abi Traceback (most
recent call last):   File
"/usr/lib/python2.7/dist-packages/logilab/common/pytest.py", line 447,
in testfile
    options=self.options, outstream=sys.stderr)   File "/usr/lib/python2.7/dist-packages/logilab/common/pytest.py", line 763,
in __init__
    testLoader=NonStrictTestLoader())   File "/usr/lib/python2.7/unittest/main.py", line 77, in __init__
    self.module = __import__(module)   File "test_abi.py", line 3, in <module>
    import ethereum.testutils as testutils   File "/home/pavel/.local/lib/python2.7/site-packages/ethereum-1.3.6-py2.7.egg/ethereum/testutils.py",
line 14, in <module>
    from ethereum import state_transition ImportError: cannot import name state_transition

至少有十个其他测试失败了,所有测试都带有相同的信息:

代码语言:javascript
复制
 ImportError: cannot import name state_transition

我很想从虚空开始,并将非常感谢任何和所有的帮助。非常感谢!

EN

回答 1

Ethereum用户

回答已采纳

发布于 2016-07-04 18:45:36

我的第一个问题是,我运行的是一个较早版本的蛇(v1.6.7),该版本仍然受到描述这里的bug的影响。我的第二个问题是由于蛇教程这里中的一个错误:要测试安装,命令是

代码语言:javascript
复制
python -m pytest test_contracts.py

(在毒蛇教程中,"-m“是在"pytest”之后,而不是在它之前)。

我更新了我的毒蛇

代码语言:javascript
复制
sudo pip install --upgrade ethereum-serpent

现在所有的测试都成功完成了。

票数 1
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/6758

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档