conda 清除 tarballs 减少磁盘占用 、 conda rename 重命名环境、conda create -n qwen --clone 当前环境

🥇 版权: 本文由【墨理学AI】原创首发、各位读者大大、敬请查阅、感谢三连

🎉 声明: 作为全网 AI 领域 干货最多的博主之一,❤️ 不负光阴不负卿 ❤️

文章目录

    • [conda clean --tarballs](#conda clean --tarballs)
    • [conda rename 重命名环境](#conda rename 重命名环境)
    • [conda create -n qwen --clone 某个环境](#conda create -n qwen --clone 某个环境)
    • [conda remove 删除环境](#conda remove 删除环境)
    • [建立 huggingface 模型下载路径的 软链接](#建立 huggingface 模型下载路径的 软链接)
    • [❤️ 欢迎和墨理一起学AI](#❤️ 欢迎和墨理一起学AI)

conda clean --tarballs

长期使用 conda 创建 N+ 环境之后,如果一段时间不再新增新的环境、刚好电脑磁盘空间不太够用了;那么 conda clean --tarballs 就可以 移除缓存中不再使用的库安装包

python 复制代码
conda clean --tarballs


Will remove 641 (3.71 GB) tarball(s).
Proceed ([y]/n)? y

conda rename 重命名环境

conda rename 使用条件如下

  • Rename an existing environment.(只能重命名已存在环境)
  • This command renames a conda environment via its name (-n/--name) or
    its prefix (-p/--prefix).
  • The base environment and the currently-active environment cannot be
    renamed.(只能重命名当前未激活的环境)

命令示例如下

python 复制代码
conda rename -n test123 test321

conda rename --name test123 test321

conda rename -p path/to/test123 test321

conda rename --prefix path/to/test123 test321

conda create -n qwen --clone 某个环境

Examples:

python 复制代码
# Create an environment containing the package 'sqlite':

conda create -n myenv sqlite

# Create an environment (env2) as a clone of an existing environment (env1):

conda create -n env2 --clone path/to/file/env1
  • 命令成功执行的命令(这个环境 8G ,因此复制环境时间较久)
python 复制代码
conda create -n qwen --clone /home/moli/anaconda3/envs/Yolov8

运行输出如下

python 复制代码
conda create -n qwen --clone /home/mo/anaconda3/envs/Yolov8

Retrieving notices: ...working... done
Source:      /home/mo/anaconda3/envs/Yolov8
Destination: /home/moli/mo/condaEnvs/envs/qwen
Packages: 23
Files: 67114


Downloading and Extracting Packages:
                                                                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                 
Downloading and Extracting Packages:                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                 
Preparing transaction: done                                                                                                                                                                                                                                                                      
Verifying transaction: done                                                                                                                                                                                                                                                                      
Executing transaction: done                                                                                                                                                                                                                                                                      
#                                                                                                                                                                                                                                                                                                
# To activate this environment, use                                                                                                                                                                                                                                                              
#                                                                                                                                                                                                                                                                                                
#     $ conda activate qwen                                                                                                                                                                                                                                                                      
#                                                                                                                                                                                                                                                                                                
# To deactivate an active environment, use                                                                                                                                                                                                                                                       
#                                                                                                                                                                                                                                                                                                
#     $ conda deactivate                  

conda remove 删除环境

Examples:

  • Remove the package 'scipy' from the currently-active environment:
python 复制代码
conda remove scipy
  • Remove a list of packages from an environment 'myenv':
python 复制代码
conda remove -n myenv scipy curl wheel
  • Remove all packages from environment myenv and the environment
    itself:
python 复制代码
conda remove -n myenv --all
  • Remove all packages from the environment myenv but retain the
    environment:
python 复制代码
conda remove -n myenv --all --keep-env

建立 huggingface 模型下载路径的 软链接

  • 把下载的模型放在 挂载磁盘上,避免占用 系统分区磁盘空间
python 复制代码
# 创建软链接示例
ln -sf /home/moli/other_disk/huggingface /home/moli/.cache/huggingface        

❤️ 欢迎和墨理一起学AI


  • 🎉 作为全网 AI 领域 干货最多的博主之一,❤️ 不负光阴不负卿 ❤️
  • ❤️ 如果文章对你有些许帮助、蟹蟹各位读者大大点赞、评论鼓励博主的每一分认真创作
相关推荐
文洪涛17 小时前
VS Code Python “第一次运行失败 / 先执行 python 再激活 Conda” 问题定位与解决
开发语言·python·conda
schinber2 天前
Python包管理工具全景指南:从pip到现代化工具实战
python·conda·pip·uv
colourmind2 天前
记录一次vscode debug conda python 使用报错问题排查
vscode·python·conda
Studying 开龙wu3 天前
Linux 系统中配置国内源下载时使用pip install 和conda install哪个快?
linux·conda·pip
KevinShi_BJ3 天前
Conda env & python 的包管理器
conda
Echo_NGC22373 天前
【传统JSCC+Deep JSCC】联合信源信道编码完全指南
人工智能·python·深度学习·神经网络·conda·无人机·jscc
多想和从前一样3 天前
2025【最新】基于conda环境从头安装MMSegmentation
conda·pip·mmsegmentation
NicoNicoleNi4 天前
Anaconda安装和环境配置实践记录
python·conda
sulikey5 天前
Conda下载依赖/包报错:Connection broken: IncompleteRead(...)
conda·connectbroken·incompleteread·网络中断
kkoral5 天前
基于MS-Swift 为 Qwen3-0.6B-Base 模型搭建可直接调用的 API 服务
python·conda·fastapi·swift