windows安装Anaconda

Anacond是什么? 和Python有啥关系?

一、Anacond 是一个python的发行版,包括了python和不少常见的软件库, 和一个包管理器conda。常见的科学计算类的库都包含在里面了,使得安装比常规python安装要容易。python

二、Anaconda是专一于数据分析的Python发行版本,包含了conda、Python等190多个科学包及其依赖项。json

Anacond下载

下载地址:www.anaconda.com/download/bash

Anacond是跨平台的,同时支持Windows、macOS、Linux,我这里下载的是Windows X64的安装包工具

Anacond安装

双击下载的安装包 测试

一步步的Next,这里注意下,官方不建议咱们把conda加入到环境变量,不加就不加呗,按照他的来,我这里默认安装的是python3.7的因此默认就是python3.7了,好了我们继续Next,因为Anacond里面包含了大量的python的包,大概占用2G的硬盘容量,因此这里选择安装位置根据本身实际状况来定。 this

安装须要一段时间,请耐心等待....url

至此Anacond安装完成,去对应的Anaconda3的安装目录下的Scripts目录下,执行 conda --version,若是显示对应的版本信息,那么Anaconda3就安装成功了。

环境配置

系统环境变量

系统环境变量path中须要添加三个目录,以下(安装目录替换下)
E:\Tool\Anaconda3
E:\Tool\Anaconda3\Scripts
E:\Tool\Anaconda3\Library\bin
而后win+R打开cmd命令,执行conda --versionpython --version,查看是否能获得和上面同样的conda的版本信息。spa

配置国内镜像地址

  • 清华镜像1 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/代理

  • 清华镜像2 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/code

  • 中科大镜像 conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/

  • 检查配置

一、打开配置 conda config --set show_channel_urls yes

二、检查配置 conda config --show channels

配置完成后会在该目录C:\Users\<你的用户名>下生成一个对应的.condarc文件

管理虚拟环境

一、建立一个名为python27的环境,指定Python版本是2.7(不用管是2.7.x,conda会为咱们自动寻找2.7.x中的最新版本) conda create --name python27 python=2.7

一、建立一个名为python37的环境,指定Python版本是3.7(不用管是3.7.x,conda会为咱们自动寻找3.7.x中的最新版本) conda create --name python37 python=3.7

C:\Users\Administrator>conda create --name python37 python=3.7
Solving environment: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/noarch/repodata.json>
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.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'mirrors.tuna.tsinghua.edu.cn\', port=443): Max retries exceeded with url: /anaconda/cloud/msys2/noarch/repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))')) 复制代码

若是出现了相似的错误,网上说配置下清华或者中科大的镜像地址就能够了,我配置了发现仍是不行,个人处理方式是,打开Anaconda Navigator经过界面去添加对应的虚拟环境然,若是仍是出现上面相似的错误,检查下你是否开启了代理工具,若是开启了先比代理工具,而后再测试下

  • 这里咱们反思下,经过界面操做就能够,那么确定是咱们缺乏了什么,咱们再回去看下.condarc文件,发现配置里面多了一个ssl_verify的配置,以下是完整的配置,若是你也出现了相似的状况那么直接把 ssl_verify: true添加上,应该就能够了,这里我没有去是,理论上应该是这样的。
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - defaults
show_channel_urls: true
ssl_verify: true

复制代码

安装和卸载第三方安装包

# 安装第三方包
conda install requests
pip install requests

# 卸载第三方包
conda remove requests
pip uninstall requests
复制代码
相关文章
相关标签/搜索