anaconda使用基础
1.基础命令
查看安装了哪些包。
conda list
查看当前存在哪些虚拟环境
conda env list 或 conda info -e
检查更新当前conda
conda update conda
查询conda版本
conda --version 或 conda -v
查询conda的命令帮助
conda -h
创建虚拟环境
conda create -n your_env_name python=X.X
激活虚拟环境
Linux: source activate your_env_name(虚拟环境名称)
Windows: activate your_env_name(虚拟环境名称)
退出虚拟环境
Linux: source deactivate
Windows: deactivate
虚拟环境中安装库
conda install -n your_env_name [package_name]
删除虚拟环境
conda remove -n your_env_name(虚拟环境名称) --all
删除环境中的某个库
conda remove --name your_env_name package_name
显示已安装的所有 Python 包及其对应的版本号
conda list python
2.配置conda数据源和pip数据源
下载三方库使用conda下载安装和使用pip下载安装都可以,国内使用最好先配置国内数据源
清华源
conda config --add channels <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/>
conda config --add channels <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/>
conda config --add channels <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/>
中科大源
conda config -–add channels <https://mirrors.ustc.edu.cn/anaconda/pkgs/free/>
显示添加的源
conda config --show channels
删除指定源
conda config --remove channels 源名称或链接
配置搜索时显示使用的源的地址
conda config --set show_channel_urls yes
显示所有数据源列表
conda config -show channels
也可以通过配置文件修改添加数据源,这里暂不详细说明
pip
永久换源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
单次换源
pip install 包名 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
国内镜像列表:
http://pypi.douban.com/simple/ 豆瓣
http://mirrors.aliyun.com/pypi/simple/ 阿里
https://pypi.tuna.tsinghua.edu.cn/simple 清华
http://pypi.hustunique.com/simple/ 华中理工大学
http://pypi.sdutlinux.org/simple/ 山东理工大学
http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学

浙公网安备 33010602011771号