如何为所有用户安装 Anaconda python?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27263620/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 01:34:51  来源:igfitidea点击:

How to install Anaconda python for all users?

pythonanaconda

提问by caesar0301

Anaconda python distributionis very convenient to deploy scientific computing env (SCE) and switch python versions as you want. By default, the installation will locate python into ~/anacondaand the SCE can only benefit the local user.

Anaconda python 发行版非常方便地部署科学计算环境(SCE)并根据需要切换 python 版本。默认情况下,安装会将python定位到~/anaconda并且SCE只能使本地用户受益。

But what I need is to provide a complete SCE wit Anaconda while masking the system-wide python version, because my cluster is running Spark and provides services for multiple users in our team. Is it possible with current Anaconda version?

但是我需要的是在屏蔽系统范围的python版本的同时提供一个完整的SCE机智Anaconda,因为我的集群运行的是Spark并且为我们团队中的多个用户提供服务。当前的 Anaconda 版本可以吗?

Xiaming

夏明

采纳答案by asmeurer

The installer lets you install anywhere. You can install it to a global location, like /opt/anaconda.

安装程序可让您在任何地方安装。您可以将其安装到全局位置,例如/opt/anaconda.

回答by Back2Basics

Anaconda Cluster from Continuum that addresses these issues. Check out https://docs.continuum.io/anaconda-scale/

来自 Continuum 的 Anaconda Cluster 解决了这些问题。查看https://docs.continuum.io/anaconda-scale/

回答by HISI

Add the anaconda PATH to /etc/profile:

将 anaconda PATH 添加到/etc/profile

for anaconda 2 :

对于蟒蛇2:

PATH=$PATH:$HOME/anaconda/bin

for anaconda 3 :

对于蟒蛇3:

PATH=$PATH:$HOME/anaconda3/bin

and then :

进而 :

source /etc/profile

回答by Shayan Amani

You definitely need to install to a path which is accessible from all users. /opt/YOUR_CONDA_DISTRIB_NAMEis a good candidate.

您肯定需要安装到所有用户都可以访问的路径。/opt/YOUR_CONDA_DISTRIB_NAME是一个很好的候选人。

However you also have to add condapath which automatically happens when you add the following shell script to other users' .bashrcfiles. You can find the shell script in the root user's .bashrcfile. For the record, I bring it here:

但是,您还必须添加conda路径,当您将以下 shell 脚本添加到其他用户的.bashrc文件时,该路径会自动发生。您可以在 root 用户的.bashrc文件中找到 shell 脚本。为了记录,我把它带到这里:


# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/YOUR_CONDA_DISTRIB_NAME/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/YOUR_CONDA_DISTRIB_NAME/etc/profile.d/conda.sh" ]; then
        . "/opt/YOUR_CONDA_DISTRIB_NAME/etc/profile.d/conda.sh"
    else
        export PATH="/opt/YOUR_CONDA_DISTRIB_NAME/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<


P.S. a few common names which Anaconda commonly uses for YOUR_CONDA_DISTRIB_NAME:

PS Anaconda 常用的一些常用名称YOUR_CONDA_DISTRIB_NAME

  • anaconda
  • anaconda3
  • miniconda
  • miniconda3
  • anaconda
  • anaconda3
  • miniconda
  • miniconda3