Anaconda和Brew的最佳做法 [英] Best Practices with Anaconda and Brew

查看:630
本文介绍了Anaconda和Brew的最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚获得了带有OSX Sierra的新Macbook,所以要确保正确设置我的开发环境.

I have just got a new Macbook with OSX Sierra, so want to ensure my development environment is setup properly.

我希望遵循此处提到的最佳做法": https://github.com/nicolashery/mac-dev-setup

I am looking to follow the 'best practices' mentioned here: https://github.com/nicolashery/mac-dev-setup

我需要Python 2.x进行工作(urllib,Pandas,Numpy,Scikit-learn),并且需要Python 3.x进行一些在线课程(Pandas,Numpy,Django). 我已经分别使用brew install pythonbrew install python3安装了Python 2和3.

I need Python 2.x for work (urllib, Pandas, Numpy, Scikit-learn), and Python 3.x for some online classes (Pandas, Numpy, Django) I am taking. I have installed Python 2 and 3, using brew install python and brew install python3 respectively.

但是,在此链接上,没有提到Anaconda,只有IPython. 鉴于我已经通过Homebrew安装了Python 2和3,是否建议使用anaconda,还是应该坚持上面Github链接中提到的标准IPython? 阅读这篇文章后,我感到困惑: OS X-在anaconda之间进行选择和自制Python环境

However, on this link, there is no mention of Anaconda, just IPython. Given that I already have Python 2 and 3 installed via Homebrew, is it even advisable to use anaconda, or should I stick to standard IPython as mentioned on the Github link above? I am confused after reading this post: OS X - Deciding between anaconda and homebrew Python environments

如果Brew和Anaconda确实可以一起工作,我可以采取哪些具体步骤来确保两个版本之间没有冲突?

If Brew and Anaconda can indeed work together, what specific steps can I take to ensure that there are no conflicts between the two versions?

推荐答案

我是python的新手,并且在安装python时遇到了麻烦.我在Mac上同时安装了homebrew和anaconda的python.我的anaconda安装弄乱了我对vim和MacVim的自制python依赖性.

I am new to python, and have had trouble with my python installation. I have both python installation from homebrew and anaconda on my mac. My anaconda installation had messed up my homebrew python dependency for vim and MacVim.

我的解决方案是每当我通过自制软件安装/更新软件包时,都将从PATH中删除anaconda.这有点麻烦,但是我偶尔会通过自制软件安装/更新软件包,所以还可以.

My solution is whenever I am installing/update package via homebrew I would remove anaconda from my PATH. This is a bit of a pain, but I only installing/updating package via homebrew once in a while so it okay.

要在python 2和3之间切换,这是我在Terminal中的命令:

To switch between python 2 and 3 here are my commands in Terminal:

$ conda search python
...
...
$ conda install python=3.5.0

$ conda info -e
# conda environments:
#
py27                     /Users/apollotang/opt/local/anaconda2/envs/py27
py36                     /Users/apollotang/opt/local/anaconda2/envs/py36
root                  *  /Users/apollotang/opt/local/anaconda2

$ source activate py36      ### <——— here is the command in to change python version 
(py36) $ conda info -e
# conda environments:
#
py27                     /Users/apollotang/opt/local/anaconda2/envs/py27
py36                  *  /Users/apollotang/opt/local/anaconda2/envs/py36
root                     /Users/apollotang/opt/local/anaconda2

(py36) $ python -V
Python 3.6.2 :: Anaconda custom (x86_64)

我从以下位置找到了此命令 如何更改默认的Anaconda python环境 http://chris35wills.github.io/conda_python_version/

I found this command from How to change default Anaconda python environment and http://chris35wills.github.io/conda_python_version/

此外,这是一篇有关在Mac上设置python环境的最佳做法的非常好的文章 https://www.davidculley.com/installing-python-on-a -mac/

Also, here is a very good article on best practice on setting up python environment on mac https://www.davidculley.com/installing-python-on-a-mac/

这篇关于Anaconda和Brew的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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