V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
duzhonglin
V2EX  ›  pytest

pytest 安装到虚拟环境

  •  
  •   duzhonglin · Apr 12, 2019 · 5078 views
    This topic created in 2576 days ago, the information mentioned may be changed or developed.
    python 代码调用 pytest 提示找不到 pytest 模块,删除虚拟环境后是正常的,不晓得是什么原因呢?
    2 replies    2019-04-12 21:11:29 +08:00
    megachweng
        1
    megachweng  
       Apr 12, 2019 via iPhone
    好歹贴一下日志和代码呀
    duzhonglin
        2
    duzhonglin  
    OP
       Apr 12, 2019
    @megachweng 这是代码
    import pytest


    def test_main():
    assert 5!=5

    if __name__ == "__main__":
    pytest.main()

    下面是报错提示:
    [Running] python -u "d:\MyPytest\test_sample.py"
    Traceback (most recent call last):
    File "d:\MyPytest\test_sample.py", line 1, in <module>
    import pytest
    ModuleNotFoundError: No module named 'pytest'

    [Done] exited with code=1 in 0.185 seconds


    在命令行是可以正常执行得
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2140 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 00:47 · PVG 08:47 · LAX 17:47 · JFK 20:47
    ♥ Do have faith in what you're doing.