如何安装部署Anaconda3?

Python

1 基础知识

1.1 Anaconda的版本

– Anaconda Enterprise版
– Anaconda Distribution版
– Anaconda Cloud版

1.2 Anaconda Enterprise

Anaconda Enterprise是一个企业级,安全且可扩展的数据科学平台,使团队能够管理数据科学资产,协作和部署数据科学项目。
详细的功能如下,
– 使用API轻松将项目部署到交互式数据库应用程序,实时笔记本和机器学习模型
– 与同事和合作者共享此应用程序
– 管理数据科学资产,包括笔记本电脑、软件包、环境和项目和提供综合数据科学体验

1.3 Anaconda Distribution

Anaconda Distribution是一个免费,易于安装的软件包管理器,环境管理器和Python发行版,包含1,000多个开源软件包,并提供免费社区支持。
以下平台均可使用,
– Windows
– MacOS
– Linux

1.4 Anaconda Cloud

Anaconda Cloud是一种包管理服务,可以轻松查找,访问,存储和共享公共笔记本和环境,以及conda和PyPI包。

2 最佳实践

2.1 安装解压工具

yum install -y bzip2

注:后面安装包需要使用

2.2 下载指定版本

cd ~
wget https://repo.continuum.io/archive/Anaconda3-5.3.0-Linux-x86_64.sh

注意:其他版本请从以下链接中下载,
https://repo.continuum.io/archive/

2.3 安装指定版本

sh ~/Anaconda3-5.3.0-Linux-x86_64.sh

可根据如下向导配置,

[...]
Please, press ENTER to continue
>>>
[...]
Do you accept the license terms? [yes|no]
[no] >>> yes

Anaconda3 will now be installed into this location:
/root/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/root/anaconda3] >>> /usr/anaconda3
[...]
Do you wish the installer to initialize Anaconda3
in your /root/.bashrc ? [yes|no]
[no] >>> no
[...]
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
>>> no

如果遇到如下错误提示,

Anaconda3-5.3.0-Linux-x86_64.sh: line 353: bunzip2: command not found

你可能需要安装如下包解决依赖关系,

yum install -y bzip2

如果遇到如下错误提示,

ERROR: File or directory already exists: '/usr/anaconda3'

你需要运行时使用“-u”参数去覆盖升级,

sh ~/Anaconda3-5.3.0-Linux-x86_64.sh -u

2.4 配置环境变量

vim /etc/profile.d/anaconda3.sh

可加入如下行定义环境变量,

# added by Anaconda3 5.3.0 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/usr/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/usr/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/usr/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/usr/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

通过如下命令使环境变量立刻生效,

source /etc/profile

2.5 测试安装

python
>>> import pandas
>>> quit()

另外,也可以使用如下命令确认,

conda list | grep anaconda

参阅文档
=================================================================

官方首页
—————
https://docs.anaconda.com/anaconda/install/linux

软件的下载
—————
https://repo.continuum.io/archive/

错误处理
—————
https://www.gitmemory.com/issue/conda/conda/9345/546488720
https://github.com/conda/conda/issues/9345

没有评论

发表回复

FTP & SFTP & FTPS
如何使用Python连接FTP?

1 前言 一个问题,一篇文章,一出故事。 笔者遇到一个需要使用Python连接ftp的需求,于是整理 …

Python
如何安装部署pysmb?

1 基础知识 pysmb是一个实验性的SMB/CIFS库 pysmb用Python编写 pysmb实 …

Python
如何安装Python的包管理器PIP?

1 基础知识 1.1 pip的介绍 pip是Python的软件包安装程序 1.2 pip的使用 详细 …