Method 1: Configure envs_dirs (Recommended)
You can tell Conda: “Please also treat /root/gpufree-data/envs as a storage location for the environment.” In this way, you can create and activate the environment directly using the name, while the files are actually stored on the data disk.
Operation steps:
-
Add the path to Conda configuration:
bash# 将数据盘目录添加到环境搜索路径的“最前面” conda config --add envs_dirs /root/gpufree-data/envs -
Verify configuration:
bashconda info # 检查输出中的 "envs directories" # 确保 /root/gpufree-data/envs 排在第一位 -
Use the name to create an environment as usual: Since the data disk path is at the first position, Conda will automatically create the new environment there by default.
bash
conda create -n openpi-server python=3.11 -y -
Activate with the name as usual:
bash
conda activate openpi-server
In this way, both the storage space problem (actually on the data disk) is solved, and the concise command experience is maintained.
Method 2: Setting Shell Alias (Alias)
If you do not want to modify the Conda configuration, you can add a alias in ~/.bashrc:
- Edit
.bashrc:bashecho 'alias act_openpi="conda activate /root/gpufree-data/envs/openpi-server"' >> ~/.bashrc source ~/.bashrc - In the future, simply enter
act_openpito activate it.
Summary: Method 1 is recommended. This is a once-and-for-all solution, and other large environments created later can also be automatically saved to the data disk.