[英]Error running tests with Conda and Tox
使用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在本地運行測試?)
我設法通過conda 安裝virtualenv來解決此問題:
conda install virtualenv
不建議自己使用virtualenv(在conda環境中使用)。 但是,當tox在內部查找軟件包時,它至少會找到兼容的版本。
Virtualenv和conda / conda-env當前不能一起玩。 參見https://github.com/conda-forge/staged-recipes/issues/1139和https://groups.google.com/a/continuum.io/forum/#!topic/conda/63B0jnPR-V4 。
更新
也相關: https : //bitbucket.org/hpk42/tox/issues/273/support-conda-envs-when-using-miniconda
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.