您的位置:首页 > 运维架构 > Linux

linux下安装Anaconda

2018-08-06 11:37 741 查看

1. 下载

下载路径:https://repo.continuum.io/archive/index.html

比如我选择安装 Anaconda3-5.2.0-Linux-x86_64.sh,(对应python3.6,x64系统)可以采用下列命令。

wget https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh[/code] 

2. 安装

chmod +x  Anaconda3-5.2.0-Linux-x86_64.sh
./Anaconda3-5.2.0-Linux-x86_64.sh

安装过程中会需要不断回车来阅读并同意license。安装路径默认为用户目录(可以自己指定),最后需要确认将路径加入用户的.bashrc中。

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>  # 要继续安装过程,请查看许可证协议。请按ENTER继续

然后按空格阅读许可协议,

Do you accept the license terms? [yes|no]
[no] >>> yes      # 是否接受协议,选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] >>>  # 是否安装到当前家目录的anaconda3目录中,默认回车即可

Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /root/.bashrc ? [yes|no]
[no] >>> yes            # 是否添加环境变量到/root/.bashrc文件

重新加载环境变量,执行:

source ~/.bashrc

此时,打开python就是最新的3.6版本了。

更新Anaconda到最新:

conda upgrade --all

3. 报错

问题

如果报下面的错误,很可能是因为设置了PYTHONPATH环境变量。这将导致Anaconda无法调用正常的自己的库(Anaconda运行不依赖PYTHONPATH环境变量)。如果报下面的错误,很可能是因为设置了PYTHONPATH环境变量。这将导致Anaconda无法调用正常的自己的库(Anaconda运行不依赖PYTHONPATH环境变量)。

Traceback (most recent call last):
File "/home/*****/anaconda3/bin/conda", line 4, in <module>
import re
File "/home/*****/anaconda3/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

方法

建议在打开python前执行

unset PYTHONPATH

或者暴力地将上述命令同样写入.bashrc文件中并用source生效。

Anaconda除了python外还包括下面几个有用的工具:

Anaconda Navigtor:用于管理工具包和环境的图形用户界面,后续涉及的众多管理命令也可以在 Navigator 中手工实现。

Jupyter notebook :基于web的交互式计算环境,可以编辑易于人们阅读的文档,用于展示数据分析的过程。

qtconsole :一个可执行 IPython 的仿终端图形界面程序,相比 Python Shell 界面,qtconsole 可以直接显示代码生成的图形,实现多行代码输入执行,以及内置许多有用的功能和函数。

spyder :一个使用Python语言、跨平台的、科学运算集成开发环境。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux 安装 Anaconda