pytest 安装到虚拟环境

2019-04-12 11:11:47 +08:00
 duzhonglin
python 代码调用 pytest 提示找不到 pytest 模块,删除虚拟环境后是正常的,不晓得是什么原因呢?
4060 次点击
所在节点    pytest
2 条回复
megachweng
2019-04-12 12:21:48 +08:00
好歹贴一下日志和代码呀
duzhonglin
2019-04-12 21:11:29 +08:00
@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


在命令行是可以正常执行得

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/554373

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX