一、软件下载
这里是从清华源下载的版本,也可以进入选择适合自己的版本:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Windows-x86_64.exe
当然也可以从官网上下载,但速度较慢。
二、安装
参考:https://www.jianshu.com/p/742dc4d8f4c5 有详细的过程,这里不做过多的描述
注:这里强调一下,使用Anaconda,对初学者很重要,只要有足够的空间,就可以不断试错,解决各种包可能存在的坑,避免对整机环境的影响
三、我遇到的问题
1、安装完成后Anaconda会创建一个叫base的默认环境,如果不切换到其他指定环境,就会一直在默认环境运行,我这里安排的版本,默认的是py3.7版本
C:\Users\chinamobile>conda env list
# conda environments:
#
base * D:\Anaconda3
2、conda默认的源,在国内通常比较慢,建议修改为清华源或中科源
conda config--addchannels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config--addchannels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config--setshow_channel_urls yes
3、更新信息失败
C:\Users\chinamobile>conda update --all
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/repodata.json>
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.
ConnectionError(ReadTimeoutError("HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn', port=443): Read timed out."))
原因:我这里的网络需要使用代理,需要给conda添加代理设置
修改anaconda的配置文件,位置在c:\User\current_user(当前用户)\.condarc,将以下内容添加进去, 替换原有内容, 修改 http://proxy.yourorg.org:port 为本地的代理地址:
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
# Show channel URLs when displaying what is going to be downloaded and
# in ‘conda list‘. Thedefault is False.
show_channel_urls: True
allow_other_channels: True
proxy_servers:
http: http://proxy.yourorg.org:port
https: http://proxy.yourorg.org:port
ssl_verify: False
注:
(1)第一个http:和https:后面跟一个空格,ssl_verify:后面也跟一个空格
(2)http:和https:后面的链接换成你的代理链接和端口号。
没有空格会报错:无效的参数
4、发现仍然报错“CondaHTTPError: HTTP 000 CONNECTION FAILED”
原因:源的配置,多了一行“- defaults” ,把这一行删除即可
注:其它一些类型报错,可参考 https://www.cnblogs.com/tianlang25/p/12433025.html
5、更新一些包的时候报错:CondaError: Downloaded bytes did not match Content-Length
原因:网络比较慢的原因,有时timeout不够用,可以把这个参数值放大,我这里放大到1000
conda config --set remote_read_timeout_secs 1000.0
注:如果仍有一些包会出现这个报错,可以直接使用conda install 或pip 安装