转载

Anaconda安装及更新失败解决方式和conda 连接超时

原创:https://blog.csdn.net/aiya_aya/article/details/78993173

安装anaconda从官网上下载慢,使用清华镜像链接下载

https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

下载完之后,尽量的按照anaconda默认的行为安装,打钩的两个地方都勾上,它会自动将bin目录加入到环境变量path中去 
安装完成后,使用系统命令行,可输入 conda list 可以看到安装了多少包。

接下来指定清华镜像,步骤如下:

执行命令,生成.condarc文件

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

Anaconda更新失败

输入命令行:conda search numpy
C:\Users\Administrator>conda search numpy
Fetching package metadata .....

错误信息:

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/pkgs/main/win-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.
ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/main/win-64/repodata.json.bz2 (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x000002AAC9D3FCF8>, 'Connection to repo.continuum.io timed out. (connect timeout=9.15)'))",),)

解决办法:

查看配置信息 输入命令:conda config –show 
显示如下信息: 
add_anaconda_token: True 
add_pip_as_python_dependency: True 
allow_softlinks: True 
always_copy: False 
always_softlink: False 
always_yes: False 
auto_update_conda: True 
binstar_upload: None 
changeps1: True 
channel_alias: https://conda.anaconda.org 
channel_priority: True 
channels: 
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 
defaults 
client_ssl_cert: 
client_ssl_cert_key: 
create_default_packages: [] 
debug: False 
default_channels: 
https://repo.continuum.io/pkgs/free 
https://repo.continuum.io/pkgs/r 
https://repo.continuum.io/pkgs/pro 
https://repo.continuum.io/pkgs/msys2 
disallow: [] 
envs_dirs: 
- C:\Anaconda3\envs 
- C:\Users\surpass\AppData\Local\conda\conda\envs 
- C:\Users\surpass.conda\envs 
json: False 
offline: False 
proxy_servers: {} 
quiet: False 
shortcuts: True 
show_channel_urls: True 
ssl_verify: True 
track_features: [] 
update_dependencies: True 
use_pip: True 
verbosity: 0

输入命令: conda - -help    //找到配置文件.condarc的路径 ,将上述显示的配置信息中-defaults所在行删除保存即可

显示信息如下: 
Options:

positional arguments: 
command 
info Display information about current conda install. 
help Displays a list of available conda commands and their help 
strings. 
list List linked packages in a conda environment. 
search Search for packages and display their information. The input 
is a Python regular expression. To perform a search with a 
search string that starts with a -, separate the search from 
the options with –, like ‘conda search – -h’. A * in the 
results means that package is installed in the current 
environment. A . means that package is not installed but is 
cached in the pkgs directory. 
create Create a new conda environment from a list of specified 
packages. 
install Installs a list of packages into a specified conda 
environment. 
update Updates conda packages to the latest compatible version. This 
command accepts a list of package names and updates them to 
the latest versions that are compatible with all other 
packages in the environment. Conda attempts to install the 
newest versions of the requested packages. To accomplish 
this, it may update some packages that are already installed, 
or install additional packages. To prevent existing packages 
from updating, use the –no-update-deps option. This may 
force conda to install older versions of the requested 
packages, and it does not prevent additional dependency 
packages from being installed. If you wish to skip dependency 
checking altogether, use the ‘–force’ option. This may 
result in an environment with incompatible packages, so this 
option must be used with great caution. 
upgrade Alias for conda update. See conda update –help. 
remove Remove a list of packages from a specified conda environment. 
uninstall Alias for conda remove. See conda remove –help. 
config Modify configuration values in .condarcThis is modeled 
after the git config command. Writes to the user .condarc 
file (C:\Users\Administrator\.condarc)by default

clean Remove unused packages and caches. 
package Low-level conda package utility. (EXPERIMENTAL)

在上面显示信息中找到config那一行,其 告诉了你的.condarc文件的路径,用记事本打开并删除-defaults那一行即可。

可正常使用:

C:\Users\Administrator>conda search numpy
Fetching package metadata .....
numpy                        1.6.2                    py26_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.6.2                    py27_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.6.2                    py26_4  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.6.2                    py27_4  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.7.0                    py26_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.7.0                    py27_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.7.0                    py33_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.7.1                    py26_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.7.1                    py27_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.7.1                    py33_0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.7.1                    py26_1  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
                             1.7.1                    py27_1  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free


conda install pip 也可正常使用
展开阅读全文

没有更多推荐了,返回首页

博客模板©2019 由CSDN提供 模版主题为:skin-yellow by CSDN官方博客 设计