除了OSX上现有的pyenv安装之外,如何安装Anaconda? [英] How can I install Anaconda aside an existing pyenv installation on OSX?

查看:118
本文介绍了除了OSX上现有的pyenv安装之外,如何安装Anaconda?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果很容易在其他地方发现此问题,请致以歉意,但是尽管我发现有很多关于pyenv和Anaconda的文章,但没有一个专门解决此问题.但是,我经常是个白痴.

Sincerest apologies if this is easily found elsewhere, but although I found a number of posts with pyenv and Anaconda explanations, none addressed this issue specifically. However, I am often an idiot.

在Mac OSX(Mojave 10.14.6)上,我通过Homebrew安装了pyenv

On Mac OSX (Mojave 10.14.6) I installed pyenv via Homebrew

brew install pyenv

我很乐意使用以下命令在Python版本之间安装和切换

And I happily install and switch between Python versions with

pyenv install ...

pyenv global ...

我通常使用VS Code作为我的IDE.

I typically use VS Code as my IDE.

我现在需要在Anaconda做一些工作.我以前没用过.我可以简单地通过分发站点安装aaconda 并使用其导航器,以及何时需要旧的python吗?版本使用pyenv和VS Code,还是在安装Anaconda时发生冲突?如果发生冲突,是否有在OSX上同时运行两者的途径?

I now have need to do some work in Anaconda. I haven't used it before. Can I simply install Anaconda via the distribution site and use its navigator, and when I need my old python versions use pyenv and VS Code, or will there be a conflict when I install Anaconda? If there would be a conflict, is there a path to running both on OSX?

我可以安装它,看看会发生什么,如果麻烦大的话,可以从备份中恢复.但是我希望pyenv/Anaconda大师可能有一些明智的建议,可以为我节省数小时的清理工作.

I could install it and see what happens of course, and restore from backup if it's a big mess. But I'm hoping that a pyenv / Anaconda guru might have some sage words of advice that would save me potentially hours of cleaning up.

提前谢谢!

推荐答案

存在冲突,导致pyenvconda都默认尝试公开全局Python环境.

There is a conflict, cause both pyenv and conda try to expose a global Python environment by default.

我一直在一起使用这些工具,而我发现的最佳解决方案是

I've been using these tools together and best solution found by me is to

  1. 始终初始化pyenv,使用pyenv global设置的Python作为默认Python
  2. 仅公开命令conda,但不要从中激活任何环境
  1. Alway initialize pyenv, use the Python set by pyenv global as the default Python
  2. Only expose command conda but do NOT activate any environment from it

详细信息

由于已经在计算机上安装了pyenv,因此只需要安装Anaconda.

Detail

Since pyenv has been installed on your machine, you only need to install Anaconda.

brew cask install anaconda

初始化conda而不暴露conda的基本"环境.

Init conda without exposing the "base" environment from conda.

# init conda, the following command write scripts into your shell init file automatically
conda init

# disable init of env "base"
conda config --set auto_activate_base false

完成.

注意:此设置后,默认的Python是pyenv global设置的Python.使用pyenvconda分别管理环境.

Note: After this setup, the default Python is the one set by pyenv global. Use pyenv and conda to manage environments separately.

管理虚拟环境的示例.

# virtual environments from pyenv
pyenv install 3.6.9
pyenv virtualenv 3.6.9 new-env
pyenv activate new-env
pyenv deactive
# You can also use `pyenv local`


# virtual environments from conda
conda create -n new-env python=3.6
conda env list
conda activate new-env
conda deactivate

pyenv的默认环境位置是~/.pyenv/versions.

Default env location for pyenv is ~/.pyenv/versions.

conda的默认环境位置,请检查conda info的输出.

Default env location for conda, check output from conda info.

  • Getting started with conda
  • Using Pip in a Conda Environment, very important
  • How do I prevent Conda from activating the base environment by default?

这篇关于除了OSX上现有的pyenv安装之外,如何安装Anaconda?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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