可以在基于conda的Python安装中使用tox吗? [英] Is it possible to use tox with conda-based Python installations?

查看:111
本文介绍了可以在基于conda的Python安装中使用tox吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python测试工具 tox 似乎旨在与virtualenv一起使用。它也可以在基于conda / anaconda的Python安装上使用吗?

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

推荐答案

虽然tox无法使用conda,但是您可以使用conda来安装 tox可以找到它们的不同Python版本(就像它将在那些文件夹中找到正常 Python安装一样)。以下内容已在Windows上进行了测试:

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. 您需要通过<$ c安装的 virtualenv $ c> pip 在根conda环境中。我怀疑这是tox将使用的virtualenv。 (我必须使用 pip install virtualenv 来安装virtualenv,以使 virtualenv 命令可以正常工作,即使 conda list 显示为已安装。)

  2. 安装要测试的Python版本。使用 conda create 可以轻松完成此操作。 tox 将在Windows中的 C:\python27 C:\中自动检测Python二进制文件python33 等,因此请使用 conda创建环境-p C:\python27 python = 2.7 等。

  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.

这篇关于可以在基于conda的Python安装中使用tox吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆