如何在最新的OS X上安装多个版本的Python并并行使用它们? [英] How can I install multiple versions of Python on latest OS X and use them in parallel?

查看:77
本文介绍了如何在最新的OS X上安装多个版本的Python并并行使用它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在OS X 10.11上使用多个Python版本运行测试,包括:

I want to run tests with multiple Python versions on OS X 10.11, including:

  • Python 2.6-?!
  • Python 2.7-默认-已解决
  • Python 3.4-?!
  • Python 3.5-通过brew安装-运行良好
  • Conda Python 3.5-?!

我想通过tox运行测试,因此tox需要能够找到它们.可悲的是,brrew似乎不想安装3.4,因为他们添加了3.5,而我显然不想删除3.5.

I want to run the tests via tox so tox needs to be able to find them. Sadly it seems that brew doesn't want to install 3.4 since they added 3.5 and I obviously do not want to remove 3.5 one.

推荐答案

This blog post suggests using pyenv with the desired detox. The basic setup with brew requires:

brew install pyenv pyenv-virtualenv pyenv-virtualenvwrapper

然后使用pyenv install [version]安装所需的Python版本,而不是使用 使用brew安装Python.您可以使用pyenv versions检查可用版本.

Then installing the desired Python versions with pyenv install [version], rather than installing Python using brew. You can check the available versions using pyenv versions.

最后,pip install detox将确保您已安装toxdetox.然后,您应该能够在tox.ini中指定所需的测试版本.

Finally, pip install detox will ensure you've got tox and detox installed. Then you should be able to specify the desired testing versions in your tox.ini.

这篇关于如何在最新的OS X上安装多个版本的Python并并行使用它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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