一、運(yùn)行命令報(bào)錯(cuò)
創(chuàng)建環(huán)境
conda create --name article_spider python=3.6
更新conda
conda update conda
運(yùn)行上述兩個(gè)命令時(shí)都報(bào)錯(cuò)
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
#如果無(wú)法解決,則刪除channels配置文件中部分內(nèi)容
#具體操作如下:
#1、快速創(chuàng)建channels配置文件的備份(保險(xiǎn)起見)
cp ~/.condarc{,.bak}
#查看配置文件的內(nèi)容
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、刪除部分內(nèi)容
#修改后配置文件的內(nèi)容如下,只保留清華的鏡像源:
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 簡(jiǎn)單實(shí)用
# 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