下载 Anaconda3-5.2.0-Linux-x86_64.sh (Ubuntu18.04的对应的Anaconda版本):
法1:在Anaconda官网下载,比较费时,如图1所示。
1)运行 .sh 文件:
bash Anaconda3-5.2.0-Linux-x86_64.sh
2)进入注册信息页面,输入yes;
3)阅读注册信息,然后输入yes;查看文件即将安装的位置,按enter,即可安装,如图
5)安装完成后,收到加入环境变量的提示信息,输入yes,如图7(图中楼主不小心按到了错误的按键);
6)看到下图这些信息说明已经安装完成。
7)提示信息“Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]”,输入no;
8)重启终端,即可使用Anaconda3;
9)若在终端输入 python,仍然会显示Ubuntu自带的python版本,我们执行:
vim ~/.condarc
在打开文件的末尾添加
export PATH="/home/zlh/anaconda3/bin:$PATH"
最后执行
source ~/.bashrc
查看安装是否成功
查看python版本:
Ubuntu安装Anconda环境时
当使用conda 创建虚拟环境时,若出现如下错误
直接用国外的源可能会报如下错:
failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/linux-64/repodata.json.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
ConnectionError(ReadTimeoutError("HTTPSConnectionPool(host='repo.anaconda.com', port=443): Read timed out."))
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
重新新建环境仍旧报错:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/linux-64/libstdcxx-ng-9.1.0-hdf63c60_0.tar.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ChunkedEncodingError(ProtocolError('Connection broken: OSError("(104, \'ECONNRESET\')")', OSError("(104, 'ECONNRESET')")))
解决办法:
打开~/.condarc,删除已有内容,加入如下内容:
vim ~/.condarc
channels:
- defaults
show_channel_urls: true
ssl_verify: false
report_errors: false
vim .condarc
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
就成功了