UV环境+UV环境中CUDA安装
一、UV安装
1、方法一:
命令:
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
这是windows的,mac和linux可以到官方教程中看:https://uv.oaix.tech/#_1
2、方法二:
GitHub中:https://github.com/astral-sh/uv/releases,下载放到想要的文件夹
环境变量Path中添加指向这个文件夹的路径
二、uv中Python安装
跟着官方文档装就行:https://uv.oaix.tech/#_5
三、cuda安装
创建虚拟环境:uv venv
激活虚拟环境:.venv\Scripts\Activate.ps1
成功进入uv环境的标志是命令前面会有个括号
然后使用命令安装cuda:
uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128