Linux下如何安装Anaconda?

下载

https://repo.continuum.io/archive/index.html上下载对应版本的Anaconda。

或者到官网:https://www.anaconda.com/download/#linux选择Linux版本下载

选择好版本后进行下载:

wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh

(下载速度可能会很慢,可以自行使用国内源)

安装

Linux下执行:

bash Anaconda3-5.0.1-Linux-x86_64.sh

安装过程中会需要不断回车来阅读并同意license

安装路径默认为用户目录(可以自己指定),最后需要确认将路径加入用户的.bashrc

 最后,立即使路径生效,需要在用户目录下执行:(一定不要忘了执行)

source .bashrc

其他

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

为了保持更新,可以在终端中执行:

conda upgrade --all

如果报下面的错误,很可能是因为设置了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生效。

参考:https://www.cnblogs.com/mypath/articles/7877493.html

猜你喜欢

转载自www.cnblogs.com/bigtreei/p/9284635.html
今日推荐