在安装了Anaconda的Mac OSX 10.8上将Python 2和3共存的最简单方法 [英] Easiest way to have Python 2 and 3 coexist on Mac OSX 10.8 with Anaconda installed

查看:122
本文介绍了在安装了Anaconda的Mac OSX 10.8上将Python 2和3共存的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Anaconda 2.3.0中使用python 2.7.10,并且在Anaconda IDE中使用了Sublime Text 3(是不同的Anaconda吗?). 但是,对于我正在学习的课程,我们要求使用python 3.5.

I am using python 2.7.10 with Anaconda 2.3.0, and I use the Anaconda IDE with sublime text 3 (is it a different Anaconda??). However, for a course I'm taking we're required to use python 3.5.

不过,我想将python 2.7保留在我的计算机上.将两个版本共存并通过终端轻松访问的最简单方法是什么(通过崇高的做法很棒,但是我现在很乐意在终端上对其进行管理)?

I would like to keep python 2.7 on my computer, though. What would be the easiest way to have both versions coexist and be easily accessible through the terminal (through sublime would be great, but I'd be happy with managing it on the terminal for now)?

此外,我通常会定期运行conda update condaconda update anaconda,以使所有内容保持最新.它将与安装的不同版本的python一起工作吗?

Also, I typically run conda update conda, and conda update anaconda on a regular basis to keep everything up to date. How would that work with different versions of python installed?

推荐答案

这种东西实际上就是Anaconda所针对的.尽管默认的Python版本取决于您使用的安装程序,但是Anaconda支持这两个版本.最简单的方法是创建一个新的虚拟环境.通过以下链接,使用此conda命令以构建Python 3环境:

This sort of thing is actually what Anaconda is built for. Although the default Python version depends on the installer you used, Anaconda supports both versions. The easiest way is to create a new virtual environment. From the following link, use this conda command to build a Python 3 environment:

conda create -n py35 python=3.5 anaconda

也就是说,如果您需要带有所有anaconda软件包的Python 3.5.如果只想使用Python 3.5的原始版本,则可以保留空白,也可以指定单个软件包.

That is if you need Python 3.5 with all the anaconda packages. You can either leave that blank if you just want a vanilla version of Python 3.5, or specify individual packages.

执行此操作后,控制台命令py35将提供Python 3.5.您绝对应该阅读以下有关如何管理环境的链接.确实,您应该阅读整个教程.

Once you do this, Python 3.5 will be available with the console command py35. You should definitely read the following link about how to manage environments. Really, you should read that whole tutorial.

这篇关于在安装了Anaconda的Mac OSX 10.8上将Python 2和3共存的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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