我通过命令行界面成功地运行了tox,运行了几个.py,但是在pycharm中,当我在我的项目库中运行tox.ini时,我得到了以下错误。我怀疑jb_tox_runner导入某些模块的环境变量设置不正确。即.py找不到它们。
Testing started at 4:39 PM ...
/usr/bin/python2.7 /opt/pycharm-community-2018.2/helpers/pycharm/_jb_tox_runner.py -e py27 -- -v --fulltrace tests/cap_plan
Traceback (most recent call last):
File "/opt/pycharm-community-2018.2/helpers/pycharm/_jb_tox_runner.py", line 9, in <module>
from tox import config as tox_config, session as tox_session
ImportError: No module named tox
Process finished with exit code 1
下面是我的run/debug配置和python解释器/virtualenv:
发布于 2018-08-07 23:35:01
经过研究,我自己回答了这个问题。我需要安装tox解释器,然后,即使我已经从pycharm之外的cli安装了tox和virtualenv,tox模块仍可用于pycharm。
发布于 2019-08-28 20:18:56
PyCharm要求Tox在项目的虚拟环境中可用。要安装Tox,使其可用,请选择:
首选项->项目: PROJECT_NAME ->项目解释器
在右侧窗格中选择相关的解释器,或创建新的解释器。用于向虚拟环境添加包的控件接近底部(参见屏幕截图)。单击“+”符号,将出现一个新屏幕,您可以在其中安装tox。
https://stackoverflow.com/questions/51658696
复制相似问题