简体   繁体   English

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

[英]How to install Anaconda python for all users?

Anaconda python distribution is very convenient to deploy scientific computing env (SCE) and switch python versions as you want. Anaconda python 发行版非常方便地部署科学计算环境(SCE)并根据需要切换 python 版本。 By default, the installation will locate python into ~/anaconda and the SCE can only benefit the local user.默认情况下,安装会将 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.但是我需要的是在屏蔽系统范围的python版本的同时提供一个完整的SCE机智Anaconda,因为我的集群运行的是Spark并且为我们团队中的多个用户提供服务。 Is it possible with current Anaconda version?当前的 Anaconda 版本可以吗?

Xiaming夏明

The installer lets you install anywhere.安装程序可让您在任何地方安装。 You can install it to a global location, like /opt/anaconda .您可以将其安装到全局位置,例如/opt/anaconda

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

Anaconda Cluster from Continuum that addresses these issues.来自 Continuum 的 Anaconda Cluster 解决了这些问题。 Check out https://docs.continuum.io/anaconda-scale/查看https://docs.continuum.io/anaconda-scale/

You definitely need to install to a path which is accessible from all users.您肯定需要安装到所有用户都可以访问的路径。 /opt/YOUR_CONDA_DISTRIB_NAME is a good candidate. /opt/YOUR_CONDA_DISTRIB_NAME是一个很好的候选者。

However you also have to add conda path which automatically happens when you add the following shell script to other users' .bashrc files.但是,您还必须添加conda路径,当您将以下 shell 脚本添加到其他用户的.bashrc文件时,该路径会自动发生。 You can find the shell script in the root user's .bashrc file.您可以在 root 用户的.bashrc文件中找到 shell 脚本。 For the record, I bring it here:为了记录,我把它带到这里:


# >>> 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 <<<


PS a few common names which Anaconda commonly uses for YOUR_CONDA_DISTRIB_NAME : PS Anaconda 通常用于YOUR_CONDA_DISTRIB_NAME的一些常用名称:

  • anaconda
  • anaconda3
  • miniconda
  • miniconda3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM