一、Windows
- 官网:https://www.anaconda.com/
- 包下载网站:https://anaconda.org/
- 超详细教程,教程1,教程2,教程3
- 安装时如果选择为所有用户安装,则启动Anaconda Prompt时要以管理员身份启动,避免管理包时报权限错误:
Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(502): An error occurred while uninstalling package 'defaults::conda-4.5.4-py36_0'.
PermissionError(13, '拒绝访问。')
Attempting to roll back.
- 修改anaconda镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
- 修改pip镜像,可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy
- 常用包管理命令
conda list
conda install package_name
conda remove package_name
conda update package_name
- 常用环境管理命令
conda env list
conda create -n python36 python=3.6
conda activate python36
conda deactivate
conda remove -n python36 --all
- pycharm配置python环境
Setting-》Project Interpreter-》点击小齿轮,Add-》选择Conda Environment-》选择Existing environment-》选择合适的python环境
- 导出环境
# 先进入想要导出的环境
conda activate xxx
conda env export --file xxx-bak.yml
- 导入环境
conda env create -f xxx-bak.yml
2.Linux
- 安装anaconda
wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh
bash Anaconda3-5.0.1-Linux-x86_64.sh