Rootop 服务器运维与web架构

自动安装anaconda(conda)

想实现自动安装anaconda(conda)python多版本环境,就用了expect实现自动应答。
脚本如下:

#!/usr/bin/expect
set timeout -1
spawn sh Anaconda2-2019.10-Linux-x86_64.sh
expect "press ENTER to continue"
send "\r"

expect "from Microsoft Corporation"
send "q"

expect "Do you accept the license terms"
send "yes\r"

expect "/root/anaconda2"
send  "/usr/local/anaconda2\r"

expect "by running conda init"
send "no\r"

expect eof

[root@MiWiFi-RA69-srv ~]# chmod 777 conda.sh
[root@MiWiFi-RA69-srv ~]# ./conda

测试通过。

最后发现anaconda支持静默安装。。。

# Anaconda 静默安装
官文:https://conda.io/projects/conda/en/latest/user-guide/install/macos.html#install-macos-silent
-b: Batch mode with no PATH modifications to shell scripts. Assumes that you agree to the license agreement. Does not edit shell scripts such as , , , etc..bashrc.bash_profile.zshrc

-p: Installation prefix/path.

-f: Force installation even if prefix already exists.-p

# 静默安装方法

[root@MiWiFi-RA69-srv ~]# sh Anaconda2-2019.10-Linux-x86_64.sh -b -p /usr/local/anaconda2/

conda版本下载归档:
https://repo.anaconda.com/archive/

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/4986.html

作者:Venus

服务器运维与性能优化

评论已关闭。