在使用Conda创建虚拟环境时,我无法使用Tox运行测试。重现错误的步骤如下。
下载存储库(它很小)和cd
到它:
git clone https://github.com/opensistemas-hub/osbrain.git
cd osbrain
使用Conda创建虚拟环境:
conda create -n asdf python=3.5
source activate asdf
pip install tox
尝试运行测试(请注意,Python 3.5是tox.ini
文件中唯一的Python解释器集):
tox
我希望Tox能够使用Conda虚拟环境中提供的Python 3.5解释器来运行测试。但是,我收到了一个错误:
ERROR: The executable ~/osbrain/.tox/py35/bin/python3.5 is not
functioning
ERROR: It thinks sys.prefix is '/usr' (should be '~/osbrain/.tox/py35')
ERROR: virtualenv is not compatible with this system or executable
Running virtualenv with interpreter ~/.miniconda3/envs/asdf/bin/python3.5
我的问题是:为什么我会收到该错误,如何避免这种情况? (即:我如何在本地为此项目运行测试并使用Tox?)
答案 0 :(得分:3)
我设法通过conda:
通过installing virtualenv来解决这个问题 conda install virtualenv
不建议您自己使用virtualenv(坚持使用conda环境)。但是,当tox在内部查找包时,它至少会找到兼容的版本。
答案 1 :(得分:1)