1. 环境管理
1 2 3 4 5 6 7 8 9 10 11
| conda create -n py_stu python=3.9 conda activate py_stu conda deactivate
conda env remove -n py_stu
conda info -e conda env list
|
2. 环境信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| conda --version
python --version
conda info
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 --set show_channel_urls yes
conda config --show channels
conda config --remove-key channels
|
3. 包管理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
conda install numpy pip install numpy
pip install numpy -i https://pypi.doubanio.com/simple/
conda update numpy pip install --upgrade numpy
conda remove numpy pip uninstall numpy
conda list pip list
|
4. 清理缓存
5. 重置环境
Conda 会记录每次变更的历史(revisions)可以滚回对应的版本。 如果某个环境安装的包比较混乱,出现了包管理损坏的问题。可以直接删除这个环境,再新建一个即可。
如果是base环境包有点混乱,或占用的内存太大,想把base环境或某个环境恢复到刚创建的干净状态。可以查看环境版本,并滚回对应的版本。
1 2
| conda list --revisions conda install --revision 0 -n base
|