微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

python – 没有名为_testcapi的模块

只需在Centos7上创建virtualenv并尝试为我的应用程序运行unittests.

   $cat /etc/redhat-release
    CentOS Linux release 7.1.1503 (Core)

    $python -V
    Python 2.7.5

    gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9)

    $py.test -v .
    ...

    $py.test -v .
    platform linux2 -- Python 2.7.5, pytest-2.8.2, py-1.4.30, pluggy-0.3.1 

    ERROR collecting tests/test_config_and_start_up.py 
    tests/test_config_and_start_up.py:11: in <module>
        from test.test_support import EnvironmentvarGuard
    ../../../../.virtualenvs/c/lib/python2.7/site-        packages/_pytest/assertion/rewrite.py:171: in load_module
        py.builtin.exec_(co, mod.__dict__)
    /usr/lib64/python2.7/test/test_support.py:22: in <module>
        import _testcapi
    E   ImportError: No module named _testcapi

与鼻子测试相同的resualt.任何想法如何解决解决这个问题?

解决方法:

安装python-test包.以root用户身份问题:

yum install python-test

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐