Is it possible to use tox with conda-based Python installations?

前端 未结 5 1859
长情又很酷
长情又很酷 2020-12-29 03:53

The Python testing tool tox seems to be designed to work with virtualenv. Can it also work on conda/anaconda-based Python installations?

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 04:39

    While tox can't make use of conda, you can use conda to "install" different Python versions where tox can find them (like it would find "normal" Python installations in those folders). The following is tested on Windows:

    1. You need virtualenv installed via pip in the root conda environment. I suspect this is the virtualenv that will be used by tox. (I had to install virtualenv using pip install virtualenv to get the virtualenv command to work, even though conda list showed it as installed.)
    2. Install the Python versions you want to test. This is easily done using conda create. tox will autodetect Python binaries on Windows in C:\python27, C:\python33, etc., so create environments using conda create -p C:\python27 python=2.7 etc.

提交回复
热议问题