如何在Homebrew Python系统上使用Conda? [英] How do I use Conda in on Homebrew Python system?

查看:278
本文介绍了如何在Homebrew Python系统上使用Conda?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Homebrew用作程序包总经理,并使用其Python和pip以及virtualenvs进行软件开发.由于各种原因,我想继续使用此结构,但是我需要一些易于使用(显然)的软件使用Conda安装.

I'm using Homebrew as my package general manager, and am using its Python and pip for software development, along with virtualenvs. For various reasons, I'd like to continue with this structure, but I need some software that is (apparently) easier to install using Conda.

我是否可以继续使用Homebrew + pip + virtualev并将Conda添加到混合中,理想情况下是在virtualenv内添加它,从而不会对整个系统产生影响?如果是这样,我如何以这种方式设置和使用Conda?

Can I continue to use Homebrew+pip+virtualev and add Conda into the mix, ideally inside a virtualenv so that it doesn't affect my system as a whole? If so, how do I set up and use Conda in this way?

(Python:2.7.11(Homebrew); pip:8.1.1; setuptools:20.6.7; OS X:10.11.4(x86_64))

(Python: 2.7.11 (Homebrew); pip: 8.1.1; setuptools: 20.6.7; OS X: 10.11.4 (x86_64))

推荐答案

您可以安装Anaconda.尝试brew cask install anaconda.按照屏幕上的说明,您可能要将export PATH=/usr/local/anaconda3/bin:"$PATH"添加到您的〜/.bash_profile或〜/.zsh文件中.

You can install Anaconda. Try brew cask install anaconda. Follow the on-screen instructions you may want to add export PATH=/usr/local/anaconda3/bin:"$PATH" to your ~/.bash_profile or ~/.zsh file.

使用anaconda,您可以创建用于python2和python3的虚拟环境.您可以设置环境,然后使用source activate py27之类的命令,假设py27是您在anaconda中的python2.7中创建的环境.它甚至具有GUI和CLI版本.

Using anaconda you can create virtual environments for python2 and python3. You can set up environments and then use commands like source activate py27 assuming py27 is an environment you created in python2.7 in anaconda. It even has GUI and CLI versions.

每次打开终端时,.bash_profile和.zshrc都将作为源.如果在上面添加source行,它将每次加载所需的版本.每个anaconda环境也都有其自己的特征. 有了Anaconda,您实际上就不再需要virtualenv了,但是您可以保留它.

Every time I open my terminal, my .bash_profile and .zshrc get sourced. If you append the source line above, it will load with the version you need everytime. Every anaconda environment has its own pip as well. With Anaconda in the mix, you'd not really need virtualenv anymore but you can keep it if you want.

如果要运行Anaconda Navigator GUI,可以运行它:open /usr/local/anaconda3/Anaconda-Navigator.app.您可以使用它来管理/创建环境和pip包等.

If you want to run the Anaconda Navigator GUI you can run it: open /usr/local/anaconda3/Anaconda-Navigator.app. You can use it to manage/create the environments and pip packages, etc.

这篇关于如何在Homebrew Python系统上使用Conda?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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