1、Conda:
Conda 是一个针对于python的开源的软件包管理系统和环境管理系统,用于安装多个版本的软件包及其依赖关系,并在它们之间轻松切换。Conda 是为 Python 程序创建的,适用于 Linux,OS X 和W indows,也可以打包和分发其他软件。是目前最流行的 Python 环境管理工具。conda有python3.x和python2.x系列两个版本,其实都没有关系,因为你在使用conda进行创建环境时,可以指定python的版本
2、conda命令:
•基本命令
(1)conda -V 或(conda --version)
判断conda当前版本
(2)conda updata conda
更新conda当前版本
(3) conda --help 或conda -h
帮助信息
•针对环境操作
(1)conda create
# 创建一个 conda 环境,名称为 tf
conda create -n 环境名 -c 镜像源
(2)conda info --envs
列出当前环境
(3)指定了python版本
conda create --name bunnies python=3.5 astroid babel
(4)从其他环境拷贝到新的环境
conda create --name flowers --clone snowflakes
(4) 删除指定环境
conda remove --name flowers --all
(6)激活环境
• Linux and macOS: source activate snowflakes
• Windows: activate snowflakes
(5) 失效环境,或切换到root环境
• Linux, macOS: source deactivate
• Windows: deactivate
•包管理命令
(1) 查询可用包版本信息
conda search --full-name python
conda search beautifulsoup4
查询在线包链接: https://anaconda.org/
(2) 查询当前环境中的包列表
conda list
(3) 在环境中安装包
conda install numpy=1.13.3 conda install --name [环境名称] beautifulsoup4
(4) pip安装命令
pip install 包名
(5) 删除包
conda remove --name [环境名称] iopro
命令列表地址:
https://conda.io/docs/commands.html
•conda配置
conda也有一个配置文件(yaml格式),名字是.condarc,该文件可以指定包搜索的url地址、proxy配置和环境目录
1.配置方式有两种:
使用conda config命令、用文本编辑器
2. 配置样例:
# This is a sample .condarc file.
# It adds the r Anaconda.org channel and enables
# the show_channel_urls option.
# channel locations. These override conda defaults, i.e., conda will
# search *only* the channels listed here, in the order given.
# Use "defaults" to automatically include all default channels.
# Non-url channels will be interpreted as Anaconda.org usernames
# (this can be changed by modifying the channel_alias key; see below). # The default is just 'defaults'.
channels:
- r
- defaults
# Show channel URLs when displaying what is going to be downloaded
# and in 'conda list'. The default is False.
show_channel_urls: True
3. conda config命令
conda config --get 显示所有的配置
conda config --get [key1] [key2] 显示指定配置
conda config --add [key] [value] 添加新配置
conda config --set [key] [value] 设置配置
conda config --remove [key] [value] 删除一个配置
conda config --remove-key [key] 删除一个key
查看命令列表
conda config --help