anaconda3 -- conda使用

一、運(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

清華大學(xué)開源軟件鏡像站 - anaconda鏡像

#首先先添加清華的鏡像源
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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容