Anaconda和conda的使用

Anaconda是一个用于科学计算的Python发行版,支持Linux、Mac、Windows. 提供了包管理和不同Python环境管理的功能, 可以很方便解决多版本Python问题和各种包安装问题. Anaconda使用conda命令来进行包管理和虚拟环境管理.

anaconda和conda区别: conda是一个工具,主要是进行包管理虚拟环境管理. anaconda是一个包含了众多的package、科学计算工具的集合, 所以我们也称Anaconda为Python的一个发行版.

一 Anaconda的下载

下载路径https://www.anaconda.com/distribution/

两个版本以及三个平台的下载

Anaconda和conda的使用_第1张图片

二 conda的使用

1.使用conda安装包  比如安装django包

conda install django

出现报错信息

Collecting package metadata: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url
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.

If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.

SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))

解决方案: 同时使用国内镜像进行安装相应的包 速度方面也会得到提升

找到用户目录下的.condarc文件,我这里是C:\Users\Kevin

将文本内容替换成以下内容

channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
ssl_verify: true
show_channel_urls: true

2. 创建虚拟环境

# 使用conda在python3.6下创建一个名称为testEve的虚拟环境

conda create -n testEve python=3.6

# 进入testEve虚拟环境中

activate testEve

  

# 查看当前python版本

python -V

  

# 退出虚拟环境

conda deactivate

# 查看当前所有的由conda创建的虚拟环境

conda-env list

  Anaconda和conda的使用_第2张图片

 # 删除虚拟环境  将创建的名为testEve,版本3.6的虚拟环境删除

conda remove -n testEve python36 --all

# 查看目前剩余的conda虚拟环境  确认是否已经删除

 Anaconda和conda的使用_第3张图片

 

你可能感兴趣的:(数据分析,python,环境搭建)