支持的硬件和驱动如下
按照表格安装好驱动。
使用conda创建好虚拟环境(Python 3.9, 3.10, 3.11, 3.12, 3.13.)后,我的显卡是arc A580
# For hardware listed in the table above, other than Intel® Core™ Ultra Series 2 Mobile Processors (Arrow Lake-H), use the commands below: python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/xpu python -m pip install intel-extension-for-pytorch==2.6.10+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/cn/ # For Intel® Core™ Ultra Series 2 Mobile Processors (Arrow Lake-H), use the commands below: python -m pip install torch==2.6.0.post0+xpu torchvision==0.21.0.post0+xpu torchaudio==2.6.0.post0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/arl/cn/ python -m pip install intel-extension-for-pytorch==2.6.10+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/arl/cn/
选择上面的两行命令执行,第二行命令运行完会有报错
大概长这样
torch 2.6.0+xpu requires intel-cmplr-lib-rt==2025.0.2, but you have intel-cmplr-lib-rt 2025.0.4 which is incompatible. torch 2.6.0+xpu requires intel-cmplr-lib-ur==2025.0.2, but you have intel-cmplr-lib-ur 2025.0.4 which is incompatible. torch 2.6.0+xpu requires intel-cmplr-lic-rt==2025.0.2, but you have intel-cmplr-lic-rt 2025.0.4 which is incompatible. torch 2.6.0+xpu requires intel-sycl-rt==2025.0.2, but you have intel-sycl-rt 2025.0.4 which is incompatible.
intel给的原因和解决方法,直接忽略
尝试运行一下
import torchprint(torch.xpu.get_device_name()) print(torch.__version__)
运行结果