一、运行命令报错
创建环境
conda create --name article_spider python=3.6
更新conda
conda update conda
运行上述两个命令时都报错
Fetching package metadata .......
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/pkgs/main/osx-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.
ConnectionError(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/main/osx-64/repodata.json.bz2 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x10a9f9940>: Failed to establish a new connection: [Errno 65] No route to host',))",),)
解决方法
参考 :http://blog.csdn.net/ada0915/article/details/78529877
#首先先添加清华的镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
#如果无法解决,则删除channels配置文件中部分内容
#具体操作如下:
#1、快速创建channels配置文件的备份(保险起见)
cp ~/.condarc{,.bak}
#查看配置文件的内容
cat ~/.condarc.bak
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- defaults
show_channel_urls: true
#2、删除部分内容
#修改后配置文件的内容如下,只保留清华的镜像源:
vim ~/.condarc
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
show_channel_urls: true
二、conda 文档
https://conda.io/docs/index.html
三、conda 简单实用
# To see a list of all your environments
conda info --envs
#To use, or “activate” the new environment, type the following
#Windows:
activate snowflakes
#Linux and macOS:
source activate snowflakes
#Change your current environment back to the default (base):
#Windows:
deactivate
#Linux, macOS:
source deactivate