pip 与 conda 的故事
pip 换源
pip 官方源 -i https://pypi.python.org/simple
pip 清华源 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip 阿里源 -i https://mirrors.aliyun.com/pypi/simple
PyTorch 安装
pip3 install torch torchvision torchaudio
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
Anaconda
查看环境 conda info -e
创建环境 conda create xxx | conda create -n xxx python=xxx
进入环境 conda activate xxx
退出环境 conda deactivate
删除环境 conda env remove -n xxx
导出环境 conda env export > xxx.yaml
导入环境 conda env create -f xxx.yaml
设置默认环境 conda config --set env_prompt ‘环境名称’
安装 ipykernel,conda install -n 环境名称 ipykernel --update-deps --force-reinstall
venv
创建环境 python -m venv xxx
进入环境
Windows
xxx\Scripts\activateLinux
. xxx/bin/activate退出环境 deactivate
导出环境 pip freeze > requirements.txt
导入环境 pip install -r requirements.txt
pip 更新
python -m pip install --upgrade pip
pip 检查可更新的库
pip list --outdated
pip 更新库
pip install --upgrade 库
GPU 查看
nvidia-smi -l 1
OneFlow 安装下载 cudnn
pip install nvidia-cudnn-cu12==8.9.7.29