PyCharm运行/调试Tox报错:找不到packaging模块,终端运行正常
PyCharm与Tox兼容问题排查
问题现象
- 在PyCharm终端执行
tox命令时,所有测试可正常启动 - 使用PyCharm运行/调试按钮(Ctrl+Shift+R)执行测试时,抛出模块找不到错误
错误信息
from packaging.requirements import InvalidRequirement, Requirement ModuleNotFoundError: No module named 'packaging' Process finished with exit code 1 Empty suite
当前环境状态
- PyCharm已将默认Python设为项目解释器
- 本地Python环境中
packaging模块已安装:
bart automated-tests % pip install packaging Requirement already satisfied: packaging in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (24.1)
tox.ini配置内容
[tox] envlist = tests skipsdist = True [testenv] basepython = python3 commands = pytest {posargs} [pytest] addopts = --basetemp="{envtmpdir}" --confcutdir=.. --sensitive-url=NONE --driver Chrome --capability browserName chrome --alluredir=reports --base-url="https://proper_url"
疑问
已查阅相关资料未找到解决方案,为何PyCharm运行/调试按钮无法正常执行测试?
内容的提问来源于stack exchange,提问作者Bart77
相关产品推荐
相关产品推荐

