這裏主要解析安裝anaconda3-5.01,清華鏡像,wordcloud時的報錯記錄
本作者電腦情況:操作系統Ubuntu14.04
開始的時候嘗試用pyenv下載anaconda
pxh@pxh:~$ pyenv install anaconda3-5.0.1
Downloading Anaconda3-5.0.1-Linux-x86_64.sh...
-> https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh
error: failed to download Anaconda3-5.0.1-Linux-x86_64.sh
BUILD FAILED (Ubuntu 14.04 using python-build 20160602)
Inspect or clean up the working tree at /tmp/python-build.20180430153443.3493
Results logged to /tmp/python-build.20180430153443.3493.log
Last 10 log lines:
/tmp/python-build.20180430153443.3493 ~
curl: (18) transfer closed with 545325503 bytes remaining to read
上網翻了個遍,沒有辦法解決,後來就改用如下方法安裝anaconda
輸入命令
wget https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
bash Anaconda3-5.1.0-Linux-x86_64.sh
這裏要注意不要以管理員的身份去下載,後果很嚴重
執行完上面兩條命令後會進入安裝界面
注意下面2處不要回車用缺省的選項:
Do you accept the license terms? [yes|no]
[no] >>> yes
Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /home/ai/.bashrc ? [yes|no]
[no] >>> yes
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
>>> no
最後驗證anaconda安裝是否成功
$ cd
$ . ./.bash_profile
$ python
[ai@AIDevEnv ~]$ python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
用exit()命令退出python
>>> exit()
上面是安裝anaconda,以下是安裝清華鏡像
插一句:或許會有人問爲什麼要安裝清華鏡像,原因很簡單,你直接用conda來下載wordcloud包是用外網來下載的,很慢,網有時會斷,清華鏡像可以幫助減少下載時間 ---這只是個人想法,不知道對不對,反正這個坑我掉過
pxh@pxh:~$ conda install wordcloud
運行報錯
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/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.
ConnectionError(ReadTimeoutError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Read timed out.",),)
解決方法
pxh@pxh:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
pxh@pxh:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
pxh@pxh:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
pxh@pxh:~$ conda config --set show_channel_urls yes
安裝wordcloud
conda install wordcloud
最後成功