cuda环境安装

1.用南京大学源下载cuda

查看显卡最高支持的cuda版本:nvidia-smi

(23 封私信 / 80 条消息) PyTorch 加速下载,使用国内的镜像源(2025年9月) - 知乎2.

复制代码
pip3 install torch torchvision torchaudio --index-url https://mirrors.nju.edu.cn/pytorch/whl/cu128

2.安装 GAN 基础工具库(同之前步骤,补充完整)

复制代码
# 基础数据处理、可视化库(conda 安装更稳定)
conda install numpy pandas matplotlib pillow scikit-learn -y

# 图像处理(OpenCV)、GAN 常用工具(ninja 加速编译,StyleGAN 等项目需要)
pip install opencv-python ninja -i https://pypi.tuna.tsinghua.edu.cn/simple

3.验证cuda能用

复制代码
import torch

# 查看 PyTorch 版本
print(torch.__version__)  # 输出示例:2.4.1(自动匹配 CUDA 12.9 的版本)

# 验证 CUDA 是否可用(关键!返回 True 表示成功)
print(torch.cuda.is_available())  # → True

# 查看当前使用的 GPU(确认显卡被识别)
print(torch.cuda.get_device_name(0))  # 输出你的显卡型号(如:NVIDIA GeForce RTX 4090)
相关推荐
花酒锄作田1 天前
Postgres - Listen/Notify构建轻量级发布订阅系统
python·postgresql
Thomas.Sir1 天前
第二章:LlamaIndex 的基本概念
人工智能·python·ai·llama·llamaindex
m0_694845571 天前
Dify部署教程:从AI原型到生产系统的一站式方案
服务器·人工智能·python·数据分析·开源
李昊哲小课1 天前
Python办公自动化教程 - 第7章 综合实战案例 - 企业销售管理系统
开发语言·python·数据分析·excel·数据可视化·openpyxl
不知名的老吴1 天前
返回None还是空集合?防御式编程的关键细节
开发语言·python
李昊哲小课1 天前
Python办公自动化教程 - 第5章 图表创建 - 让数据可视化
python·信息可视化·数据分析·数据可视化·openpyxl
chushiyunen1 天前
python pygame实现贪食蛇
开发语言·python·pygame
Dream of maid1 天前
Python-基础2(流程控制)
python
Lenyiin1 天前
《Python 修炼全景指南:一》从环境搭建到第一个程序
开发语言·python
涛声依旧393161 天前
Python项目实战:学生信息管理系统
开发语言·python·数据挖掘