Files
shellscripts/manage_pixi.sh
Your Name b00f025742 update
2024-11-12 00:07:46 +08:00

43 lines
1.0 KiB
Bash

#!/bin/bash
PIXIDIR="$HOME/.pixi"
BASHRC="$HOME/.bashrc"
install_pixi() {
# 安装 Pixi
echo "安装 Pixi..."
curl -fsSL https://pixi.sh/install.sh | bash
# 将 Pixi 路径添加到环境变量中
if ! grep -q 'export PATH="$HOME/.pixi/bin:$PATH"' "$BASHRC"; then
echo 'export PATH="$HOME/.pixi/bin:$PATH"' >> "$BASHRC"
source "$BASHRC"
fi
# 配置 Conda 源
echo "配置 Conda 源..."
pixi config append default-channels conda-forge
pixi config append default-channels bioconda
pixi config append default-channels pytorch
pixi config append default-channels pytorch-nightly
pixi config append default-channels nvidia
echo "Pixi 安装和配置完成!"
}
uninstall_pixi() {
# 卸载 Pixi
echo "卸载 Pixi..."
rm -rf "$PIXIDIR"
sed -i '/export PATH="\$HOME\/.pixi\/bin:\$PATH"/d' "$BASHRC"
echo "Pixi 已卸载。"
}
if [ "$1" == "install" ]; then
install_pixi
elif [ "$1" == "uninstall" ]; then
uninstall_pixi
else
echo "使用方法: $0 {install|uninstall}"
fi